Apache Single-server multiport multi-site configuration

Source: Internet
Author: User
Tags apache error log

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.