Multiple Apache services
Change the root directory of the first site:
Find the DocumentRoot attribute in the apache2.2/CONF/httpd. conf file, and change the following path to the path of your main site,
For example, D:/www/web1
Create a configuration file for the second apache service:
Copy and rename httpd. conf to web2.conf (for example, my. conf ),
Modify
Listen 8080 (originally 80)
Servername localhost: 8080 (originally 80)
DocumentRoot "D:/www/web2" (originally web1)
Add the second apache service:
Run the following command in the bin subdirectory of the Apache installation directory to install Apache as a Windows NT Service:
# If you run CMD in windows to the bin directory of the Apache installation directory:
# Run:
Httpd.exe-K install-n "service name"-F "D:/apache2.2/CONF/web2.conf"
Other commands:
Install Apache as a Windows NT Service:
Httpd-K install
Specify the service name. When You Install Multiple Apache services on the same machine, you must specify different names for them.
Httpd-K install-n "service name"
To use different configuration files for services with different names, you must specify the configuration file during installation:
Httpd-K install-n "service name"-F "C:/files/My. conf"
If you are using the first command, that is, there are no other command line parameters except-K install, the installed Service name will be: apache2, the configuration file will use CONF/httpd. conf.
Remove an apache service:
Httpd-K uninstall
Run the following command to remove an apache service with a specific name:
Httpd-K uninstall-n "service name"
Generally, the apache service monitor tool is used to start, restart, and shut down the apache service. You can also use the Console Commands: Net start apache2 and net stop apache2 or use the Windows Service Control Panel. Before starting the apache service, you should use the following command to check the correctness of the configuration file:
Httpd-n "service name"-T
You can use the command line switch to control the apache service. To start an installed apache service, you can use:
Httpd-K start
To stop an installed apache service, you can use:
Httpd-K stop
Or
Httpd-K shutdown
To restart a running Apache service and force it to re-read the configuration file, you can use:
Httpd-K restart