安装:
# yum install httpd
主配置文件:
/etc/httpd/conf/httpd.conf
log路径:
/var/log/httpd
启动:
# systemctl start httpd
# systemctl enable httpd
开放防火墙:
# firewall-cmd --permanent --add-service=http
其它地址访问该web(selinux):
# setsebool -P httpd_can_network_relay on
对目录设置访问权限:
在<Directory "/var/www/html">里添加
order deny,allow
deny from all
allow 10.0.0.0/24
allow .ming.com (注:前没*)
allow localhost
:wq
注:allow可以写多行,但不能并排写,域名时前不能带"*"
配置虚拟主机:
多端口:
# vi /etc/httpd/conf/httpd.conf (最后添加)
Listen 81
<VirtualHost *:81>
DocumentRoot "/var/www/html/ming"
</VirtualHost>
:wq
多域名:
# vi /etc/httpd/conf/httpd.conf (最后添加)
<VirtualHost *:80>
ServerName aa.ming.com
DocumentRoot "/var/www/html/ming2"
</VirtualHost>
:wq
时间: 2024-09-29 22:34:12