22. Then modify the http.conf (D:\phpEnv\Apache24\conf\http.conf) configuration file-use Notepad to open the line
(1) Modify the root path of the ServerRoot Apache:
(37 lines) ServerRoot "C:/apache24" changed to =>serverroot "D:/phpenv/apache24"
(2) modify servername your host name:
(217 lines) SERVERNAMEWWW.EXAMPLE.COM:80 removes the previous #, which is required when launching Apache from the command line.
(3) modify DocumentRoot Apache access to the home folder directory, is the location of PHP, HTML code files. Apache default path is under Htdocs (D:\phpEnv\Apache24\htdocs), there will be a simple entry file index.html. This path can be modified on its own, and I will configure it in my own new folder, www (D:\phpEnv\www).
(247 lines) DocumentRoot "C:/apache24/htdocs"
<directory "C:/apache24/htdocs" >
Change to =
DocumentRoot "D:\phpEnv\www"
<directory "D:\phpEnv\www" >
(4) Modify the Portal file configuration: DirectoryIndex generally we are index.php, index.html, index.htm as the portal for Web projects. Apache Default portal only index.html need to add the other two support, of course, the settings of this portal file can be increased or decreased according to their own needs, if the requirements are more stringent can only write a index.php, so that the entry in the project can only be index.php
(274 lines) <IfModuledir_module>
Directoryindexindex.html
</IfModule>
Change to =
<IfModuledir_module>
DirectoryIndex index.php index.htm index.html
</IfModule>
(5) set the Serverscript directory:
(358 lines) scriptalias/cgi-bin/"c:/apache24/cgi-bin/" to = = scriptalias/cgi-bin/"D:/phpenv/apache24/cgi-bin"
(6) (380 lines)
<directory "C:/apache24/cgi-bin" >
AllowOverride None
Options None
Require all granted
</Directory>
Change to =
<directory "D:/phpenv/apache24/cgi-bin" >
AllowOverride None
Options None
Require all granted
</Directory>
33. You can start Apache next.
Start---Run, enter cmd, and open a command prompt. Then enter the D:\phpEnv\Apache24\bin directory to enter httpd enter.
You can test without an error (Keep the command window open).
Put the index.html in the Apache24\htdocs directory in the D:\phpEnv\www directory, access to the browser will appear "It works" that the Apache has been properly installed and started. You can also write a simple index.html file or open it yourself.
44. Add Apache to the window service startup and set it to boot
Close the HTTPD service first (Close the command window)
Reopen a new command window into the D:\phpEnv\Apache24\bin directory:
The command to add the HTTP service is: Httpd.exe-kinstall-n "ServiceName" ServiceName is the name of the service, I added: Httpd.exe-k install-n "Apache24" After the command succeeds, you will be prompted to see the Apache24 Service in the Window service startup item.
Then click on to start, if you do not want to set up the boot, you can also modify the startup type to Manual.
If you want to uninstall this service, first stop the service and then enter Httpd.exe-k uninstall-n "Apache24" to uninstall the service.
Of course, you can also start Apache by D:\phpEnv\Apache24\bin the ApacheMonitor.exe below, and there's not much to say.
So the Apache configuration is basically done.
END