Method of adding a port to the Apache virtual host

  • 2020-05-14 05:23:42
  • OfStack

Go to your apache installation directory, go to the httpd.conf file,
Search for #listen and add it below

listen 800
     listen 801
     listen 802


Here is the test, you can add different listening ports according to your needs, ok, apache web port is open, we are going to configure 1 virtual host.

find


#<virtualhost *:80>
#    serveradmin webmaster@dummy-host2.phps The tutorial hao.cublog.cn
#    documentroot /www/docs/dummy-host2.phps The tutorial hao.cublog.cn
#    servername dummy-host2.phpshao.cublog.cn
#    errorlog logs/dummy-host2.phpshao.cublog.cn-error_log
#    customlog logs/dummy-host2.phpshao.cublog.cn-access_log common
#</virtualhost>

Type this code, because the installation directory is not the same, there will be a small difference, we directly search < virtualhost *:80 > Ok, and then I'm going to go down here

 <virtualhost 192.168.0.110:802> //802 We're increasing surveillance web port 
        serveradmin qq@sina.com
        documentroot d:/www/www.php100.com/
        servername www.php100.com
        errorlog logs/dummy-host2.phpshao.cublog.cn-error_log
        customlog logs/dummy-host2.phpshao.cublog.cn-access_log common
    </virtualhost>

At the last step, restart apache to ok


Related articles: