安装httpd
yum -y install httpd
httpd基本配置和应用
主配置文件:/etc/httpd/conf/httpd.conf
分段配置文件:/etc/httpd/conf.d/*.conf
服务脚本:/etc/rc.d/init.d/httpd
脚本的配置文件:/etc/sysconfig/httpd
模块文件目录:/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
rpm -ql httpd
/etc/httpd #httpd的工作目录
/etc/httpd/conf #主配置文件文件目录
/etc/httpd/conf.d
/etc/httpd/conf.d/README
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf.modules.d
/etc/httpd/conf.modules.d/00-base.conf
/etc/httpd/conf.modules.d/00-dav.conf
/etc/httpd/conf.modules.d/00-lua.conf
/etc/httpd/conf.modules.d/00-mpm.conf
/etc/httpd/conf.modules.d/00-proxy.conf
/etc/httpd/conf.modules.d/00-systemd.conf
/etc/httpd/conf.modules.d/01-cgi.conf
/etc/httpd/conf/httpd.conf #主配置文件
/etc/httpd/conf/magic
/etc/httpd/logs
/etc/httpd/modules
/etc/httpd/run #httpd运行时的pid文件
/etc/logrotate.d/httpd
/etc/sysconfig/htcacheclean
/etc/sysconfig/httpd
/usr/sbin/apachectl
/usr/sbin/fcgistarter
/usr/sbin/htcacheclean
/usr/sbin/httpd
/usr/sbin/rotatelogs
/usr/sbin/suexec
/var/cache/httpd
/var/cache/httpd/proxy
/var/lib/dav
/var/log/httpd #日志文件目录
/var/www
/var/www/cgi-bin #CGI能够执行的动态脚本
/var/www/html #文档根目录,站点页面文件存放目录
启动httpd
service httpd start
ss -tunlp|grep httpd #默认监听在80端口
tcp LISTEN 0 128 *:80 *:* users:
(("httpd",pid=17665,fd=3),("httpd",pid=17664,fd=3),("httpd",pid=17663,fd=3),
("httpd",pid=17654,fd=3),("httpd",pid=17653,fd=3),("httpd",pid=17652,fd=3),
("httpd",pid=17651,fd=3),("httpd",pid=17650,fd=3),("httpd",pid=17649,fd=3))
ps aux|grep httpd
root 17649 0.2 0.1 224084 5052 ? Ss 10:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17650 0.0 0.0 226304 3832 ? S 10:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17651 0.0 0.0 226168 3092 ? S 10:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17652 0.0 0.0 226168 3092 ? S 10:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17653 0.0 0.0 226304 3836 ? S 10:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17654 0.0 0.0 226168 3092 ? S 10:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17663 0.0 0.0 226168 3092 ? S 10:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17664 0.0 0.0 226168 3092 ? S 10:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 17665 0.0 0.0 226168 3092 ? S 10:39 0:00 /usr/sbin/httpd -DFOREGROUND
root 17676 0.0 0.0 112812 972 pts/1 R+ 10:39 0:00 grep --color=auto httpd
我们看到一共启动了9个httpd进程,一个root用户启动httpd进程是主进程(不直接响应用户请求),apache用户启动的8个httpd进程是子进程(也叫工作进程,启动多少个工作进程可以在配置文件中设置)
浏览器访问ip即可看到默认站点主页
修改配置文件,重载:
service httpd reload