工作模式:prefork,worker,event
- 更换工作模式
1.若是以yum安装的httpd2.4,则只需修改/etc/httpd/conf.d/00-mpm.conf文件,将目标模式行注释启用起来,同时注释掉另外两个模式
查看模式 httpd -M| grep mpm
2.若以源码安装httpd2.4,首先在httpd.conf激活httpd-mpm.conf的使用,则需要去修改安装目录下的extra/httpd-mpm.conf,接着修改httpd.conf下的LoadModule里面mpm模块名称和路径,重启服务生效
虚拟主机:virtualhost
1.注销掉httpd.conf 下的 DocumentRoot
2. cd /etc/httpd/conf.d/
3. vi virtualhost1.conf
<VirtualHost 192.168.1.15:80>
ServerName
DocumentRoot "/web/vhosts/www1"
<Directory "/web/vhosts/www1">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 192.168.1.15:80>
ServerName www2.stuX.com
DocumentRoot "/web/vhosts/www2"
<Directory "/web/vhosts/www2">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
4.mkdir -pv /web/vhosts/www{1,2}
5.访问虚拟主机:
修改hosts文件
在浏览器中输入www1.stuX.com