Configuring Apache and Implementing multiple Sites

Source: Internet
Author: User
Tags command line

Configuring Apache and Implementing multiple Sites

After you install Apache, you can enter the http://localhost test in the browser, and if the configuration is normal it will show it ' s/working.

Change the root of the first site: Look for the DocumentRoot property in the file apache2.2confhttpd.conf, and change the following path to the path of your primary site, such as: D:wwwweb1

Create a profile for the second Apache service: Copy and rename httpd.conf to web2.conf (for example, also call my.conf, etc.), modify listen 8080 in web2.conf (formerly 80), ServerName localhost:8080 (originally 80), DocumentRoot "D:/www/web2" (originally for Web1)

Add a second Apache service: under the bin subdirectory of the Apache installation directory, use the following command to install Apache as Windows NT service: httpd.exe-k install-n "service name"-F "D: Apache2.2confweb2.conf "

Other commands:

To install Apache as a Windows NT service:

Apache-k Install

Specify the name of the service, and when you install multiple Apache services on the same machine, you must specify a different name for them.

Apache-k install-n "Service Name"

To use a different profile for a service of different names, you need to specify the configuration file when you install:

Apache-k install-n "service name"-F "c:filesmy.conf"

If you are using the first command, that is, there are no command-line arguments except for-K install, the service name installed will be: Apache2, the configuration file will use confhttpd.conf.

To remove an Apache service:

Apache-k Uninstall

Remove the Apache service with a specific name using the following command:

Apache-k uninstall-n "Service Name"

Typically, the way to start, restart, and shut down the Apache service is to use the Apache Services Monitor tool, as well as console commands: net start Apache2 and net STOP Apache2 or through the Windows Services Control Panel. Before starting the Apache service, you should use the following command to check the correctness of the configuration file:

Apache-n "service Name"-T

You can control the Apache service with command line switches. To start an already installed Apache service, you can use:

Apache-k start

To stop an already installed Apache service, you can use:

Apache-k stop


Apache-k shutdown

To reboot a running Apache service and force it to re-read the configuration file, you can use:

Apache-k restart

Note: If you use the following version of Apache2.0, the service program is Apache.exe

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.