Apache配置站點詳細講解(apache目錄結構介紹)
查看Apache有哪些參數:/application/apache2.2.34/bin/apachectl
查看Apache安裝了哪些模塊:/application/apache2.2.34/bin/apachectl -l
跟蹤apache進程:strace /application/apache2.2.34/bin/apachectl -M
如果解析很慢,打開/etc/hosts/文件在第一行後面加上httpd
############################
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 httpd############################
#可以使用DSO方式往Apache裏面添加其他模塊
- -with -apxs2=/application/apache2.2.34/bin/apxs
建立站點:
1.進入Apache安裝目錄下:cd /application/apache2.2.34/
2.進入conf目錄:cd conf/
3.查看首頁存放位置:grep -i documentroot httpd.conf
4.退出當前目錄再進入到主頁位置:cd ../htdocs/
5.查看主頁內容:cat index.html
編輯首頁vim index.html會發現it work!已發生改變了。
<html>
<head><title>ldwt.s.blog.</title></head>
<body>HI,this is LINUX. My blog address is
<a href="http://blog.51cto.com/13233089" targe=_parent>http://blog.51cto.com/13233089</a>
</body>
</html>
6.[root@localhost htdocs]# pwd
/application/apache2.2.34/htdocs
- 復制並改名index.html文件為ldwt.html:cp index.html ldwt.html
8.進入到主配置文件目錄:
[root@localhost htdocs]# cd ../conf/
9.編輯朱配置文件:
[root@localhost htdocs]#vim httpd.conf
ps:在vi編輯器裏面輸入:/DirectoryIndex關鍵字搜索到圖上位置,插入ldwt.html
此時首頁已經變更(輸入ip地址後首頁文件不在是index.html而是ldwt.html)
檢查語法:/application/apache2.2.34/bin/apachectl -t
平滑重啟Apache:/application/apache2.2.34/bin/apachectl graceful
########################################
apache目錄結構:bin-->apachectl 啟動命令
-->apxs 為Apache編譯安裝擴展模塊的工具,使用DSO方式編譯模塊時會用到
-->htpasswd 建立和更新基本認證文件
-->httpd 控制開關程序
-->rotatelogs 自帶日誌輪詢命令
conf-->httpd.conf 主配置文件(重要文件)
-->extra 主配置文件中的一個子配置文件
logs-->access_log 啟用目錄
-->error_log 錯誤日誌
htdocs 默認安裝的站點目錄
-->index.html 默認的首頁文件(修改主配置文件中DirectoryIndex可更改首頁)
Apache配置站點詳細講解(apache目錄結構介紹)