Bloggers are passionate about all kinds of internet technology, often wordy, often accompanied by obsessive-compulsive disorder, often updated, I think the article is helpful to you can pay attention to me. Reprint please indicate "The sickle of Deep Blue"
Assuming that your site's IP is 12.34.56.78, you want to implement input 12.34.56.78:81 after accessing the "/yourpath/www81" directory under the website, and enter 12.34.56.78:82 after accessing "/yourpath/www82" The site under the directory.
First make sure that the port is not occupied by another process, and if it is turned off, the process is not enabled and set to boot.
First find your Apache configuration file httpd.conf, find "Listen 80" This sentence, if not, in ServerRoot "..." After this sentence add "Listen 80", followed by add you need to listen to the port (80 port is generally the default port, that is, you input 12.34.56.78 and 12.34.56.78:80 is the same effect )
ServerRoot "/yourpath/server/httpd" Listen 80Listen 82Listen 84
then use the text editor in your Apache directory to create a new file "httpd-vhosts.conf", such as:/yourpath/server/httpd/conf/my-httpd-vhosts.conf, and enter the following configuration, 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
This file is introduced in the httpd.conf configuration
ServerRoot "/yourpath/server/httpd" Listen 80Listen 82Listen 84include/yourpath/server/httpd/my-httpd-vhosts.conf
Create a new three port configuration file
/yourpath/server/httpd/conf/vhosts/80.conf
/yourpath/server/httpd/conf/vhosts/81.conf
/yourpath/server/httpd/conf/vhosts/82.conf
and make the following configuration (depending on the port to change the corresponding number)
<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 new website in the www82 directory, and visit 12.34.56.78:82 to try it.
If Apache does not boot, check for spelling errors or check the Apache error log directly.
Apache Single-server multiport multi-site configuration