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 8001
<VirtualHost *:8001>
    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 8002
<VirtualHost *:8002>
    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配置多域名


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM