Apache Single Server multi-port multi-site configuration, apache Port Site
Bloggers are keen on a variety of Internet technologies. They are often nagging and often accompanied by obsessive-compulsive disorder and are often updated. If they think that the articles are helpful to you, they can pay attention to me. For more information, see "Deep Blue Sickle"
Assume that the ip address of your website is 12.34.56.78, and you want to enter 12.34.56.78: 81 to access the website under the "/yourpath/www81" directory, and enter 12.34.56.78: access the website under the "/yourpath/www82" directory.
First, make sure that the port is not occupied by other processes. If yes, disable the process and set it to start at startup.
First find your Apache configuration file httpd. conf, find the "Listen 80" sentence, if not, in ServerRoot "... "add" Listen 80 "after this sentence, and then add the port you want to Listen to (port 80 is generally the default port, that is, you enter 12.34.56.78 and 12.34.56.78: 80 is the same effect)
ServerRoot "/yourpath/server/httpd"Listen 80Listen 82Listen 84
Then create a file "httpd-vhosts.conf", such as/yourpath/server/httpd/conf/my-httpd-vhosts.conf in your Apache directory, and enter the following configuration to save.
NameVirtualHost *:80Include /yourpath/server/httpd/conf/vhosts/80.confNameVirtualHost *:81Include /yourpath/server/httpd/conf/vhosts/81.confNameVirtualHost *:82Include /yourpath/server/httpd/conf/vhosts/82.conf
Introduce this file in httpd. conf configuration
ServerRoot "/yourpath/server/httpd"Listen 80Listen 82Listen 84Include /yourpath/server/httpd/my-httpd-vhosts.conf
Create three new port configuration files
/Yourpath/server/httpd/conf/vhosts/80. conf
/Yourpath/server/httpd/conf/vhosts/81. conf
/Yourpath/server/httpd/conf/vhosts/82. conf
Perform the following configuration (change the number based on the port)
<VirtualHost *:82> DocumentRoot /yourpath/www82 ServerName localhost ServerAlias localhost ErrorLog "/yourpath/server/httpd/log/default-error-82.log" CustomLog "/yourpath/server/httpd/log/default-82.log" common</VirtualHost>
Restart apache, create a website under the www82 directory, and visit 12.34.56.78: 82.
If apache cannot be started, check whether the spelling is correct or directly view the apache error log.