Apache Single Server multi-port multi-site configuration, apache Port Site

Source: Internet
Author: User
Tags apache error log

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.


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.