apache下设置域名多站点访问及禁止apache访问80端口

apache下设置域名多站点访问

当前系统:macOS High Sierra

域名访问配置指定端口后,不同域名只能配置不同的端口

apache配置目录:

sudo vim /etc/apache2/httpd.conf
sudo vim /etc/apache2/extra/httpd-vhosts.conf

具体代码如下(/etc/apache2/extra/httpd-vhosts.conf):

Listen
<VirtualHost *:>
DocumentRoot "/Users/wanghaokun/dev/code/demo"
ServerName localhost
ErrorLog "/private/var/log/apache2/localhost-error_log"
CustomLog "/private/var/log/apache2/localhost-access_log" common
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost> Listen
<VirtualHost *:>
DocumentRoot "/Users/wanghaokun/dev/code/phalcon54/"
ServerName www.testphalcon.com
ErrorLog "/private/var/log/apache2/testphalcon-error_log"
CustomLog "/private/var/log/apache2/testphalcon-access_log" common
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>

apache启动方式:

sudo apachectl start
sudo apachectl stop
sudo apachectl restart

禁止apache访问80端口

在apache配置目录中查找80端口占用情况,修改或注释对应代码段即可

apache下设置域名多站点访问及禁止apache访问80端口

相关文档:apache配置多域名

上一篇:6月19日 NSFileHandle文件类的常用方法


下一篇:C++ 抽象类与接口