原創做品,容許轉載,轉載時請務必以超連接形式標明文章 原始出處 、做者信息和本聲明。不然將追究法律責任。http://houzhimeng.blog.51cto.com/3938990/1703920html
1.安裝httpdlinux
1
|
yum -y
install
httpd
|
2.關閉selinux,iptables程序:瀏覽器
1
2
|
[root@localhost ~]
# service iptables stop
[root@localhost ~]
# setenforce 0
|
3.查看下當前系統80端口是否被佔用:bash
1
2
3
4
5
6
7
|
[root@localhost ~]
# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::22 :::*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 100 127.0.0.1:25 *:*
[root@localhost ~]
#
|
httpd基本配置和應用:dom
主配置文件:/etc/httpd/conf/httpd.confide
分段配置文件:/etc/httpd/conf.d/*.conf測試
服務腳本:/etc/rc.d/init.d/httpdspa
腳本的配置文件:/etc/sysconfig/httpdrest
模塊文件目錄:/etc/httpd/modules --> /usr/lib64/modules日誌
主程序文件:/usr/sbin/httpd (prefork)
/usr/sbin/httpd.worker (worker)
/usr/sbin/httpd.event (event)
日誌文件目錄:/var/log/httpd
Access_log:訪問日誌文件
Error_log:錯誤日誌
站點文檔目錄:/var/www/html
4.啓動httpd:
1
2
3
4
5
|
[root@localhost ~]
# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1
for
ServerName
[ OK ]
[root@localhost ~]
#
|
啓動時的報錯信息:是沒法當前使用主機的主機名。沒有問題能夠忽略。
並且此時的80端口已經啓動監聽,能夠用瀏覽器來訪問:
1
2
3
4
5
6
7
8
|
[root@localhost logs]
# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 100 127.0.0.1:25 *:*
[root@localhost logs]
#
|
成功訪問測試頁面,由於沒有主頁,把403的頁面定位在welcome.conf頁面:
修改welcome.conf文件就會出來系統內部文件頁面系統:
1
2
3
|
[root@localhost conf.d]
# ls
README welcome.conf.bak
[root@localhost conf.d]
#
|
修改以後複製一個文件進去會顯示: