• Build Apache Servers
-apache Server Download address (http://httpd.apache.org/)
Click Download, enter the following page, select the Circle section
Go to Apache Windows download page
All the files here are compiled, copy the folder to the hard disk to use, download the second one.
• Configure the Apache server environment
Now start configuring the server, first open the httpd.conf configuration file under the Conf directory
Find the ServerRoot "C:/apache24" line,
Changes according to the actual directory, so instead: ServerRoot "C:/www/apache24"
Find #servername www.example.com:80 and remove the front #
And then find DocumentRoot "C:/apache24/htdocs" This means that our web resources are placed in the root directory, here I changed to: DocumentRoot "C:/www/apache24/htdocs"
And then the following line: <directory "C:/apache24/htdocs" > This is also a directory of Web resources, so instead: <directory "C:/www/apache24/htdocs" >
Then find:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
This means that our default home page program can be set to: directoryindexindex.html index.htm index.php This configuration is accessed in order of priority
Then found: scriptalias/cgi-bin/"c:/apache24/cgi-bin/" here means to set the CGI directory, in the Apache directory has a cgi-bin directory, so this should be changed to: Scriptalias/ cgi-bin/"c:/www/apache24/cgi-bin/"
Then find:
<directory "C:/apache24/cgi-bin" >
AllowOverride None
Options None
Require all granted
</Directory>
This code, note and our previous Web root directory is not the same location, the place is also changed to Cgi-bin directory, and scriptalias like the line
Here, our Apache server configuration is complete, and now you can parse the HTML run app
Now, run cmd, enter the C:\www\Apache24\bin directory, the directory of Httpd.exe is the server execution program, according to the official website, we first put Apache as an application software service installed in the system services, run the command:
Httpd-k install-n "Apacheserver"
After executing this command, if there is no problem, the Apache service installed successfully, the service name is: Apacheserver This we can customize, if only to execute
Httpd-k Install
This defaults to installing the Apache service named: Apache2.4
If the installation prompt, OS 5 denial of service, AH00369 such errors, the reason is that we do not have permission to perform operations, then need to enter the C:\Windows\System32 directory, right-click Cmd.exe choose to run as an administrator, so that the installation is successful
Now run Services.msc can see the newly installed services, and the default is automatic, is automatically started with the system, not every time we start again,
If you want to manually start or shut down or restart the server there are two ways, one is in the system service right-click the corresponding operation, relatively simple
The other is to use the command line to operate:
Start: Httpd-k start-n "Apacheserver" or the default is Httpd-k start
Stop: Httpd-k stop-n "Apacheserver" or httpd-k shutdown-n "Apacheserver"
Restart: httpd-k restart-n "Apacheserver"
Execute if you need to uninstall the service: Httpd-k uninstall-n "Apacheserver"
Now, if we visit http://localhost or http://127.0.0.1, if we can see the Welcome page of the It works!, which is to access the Index.html program under the root directory, then the Apache environment is OK.
If IIS is installed on the computer, a port conflict may occur:
(OS 10013) makes an attempt to access the socket in a way that is not allowed by access rights. : Make_sock:could not bind to address 0.0.0.0:80
Modify at this time
• Install multiple Tomcat
To download the Tomcat file and install multiple tomcat on the same computer, you need to change the port settings, respectively
Where the port at AJP is the port that the Apache agent needs to connect to later
• Configure Apache+tomcat load Balancing (cluster)
First configure the Apache root directory under the Conf folder of the httpd.conf file, the following image shown in the front of the module * removed (if the missing module may be reported 500 error)
Then put:
#Include conf/extra/httpd-vhosts.conf annotations are also removed, configured for load Balancing
Enter into the conf/extra/httpd-vhosts.conf and comment out the original
Add the following content
Load balancing can be achieved by accessing the localhost:9999 port at this time. The ports AJP here are the AJP port numbers of the front tomcat settings