原创做品,容许转载,转载时请务必以超连接形式标明文章 原始出处 、做者信息和本声明。不然将追究法律责任。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]
#
|
修改以后复制一个文件进去会显示: