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 "
To install Apache as a Windows NT service:
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:
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:
To stop an already installed Apache service, you can use:
To reboot a running Apache service and force it to re-read the configuration file, you can use:
Note: If you use the following version of Apache2.0, the service program is Apache.exe