Installation and configuration tutorial for windows Server Apache2.4.16

Source: Internet
Author: User
Tags apache download port number

Download the Apache installation package

Apache official website: http://httpd.apache.org/

The Apache website does not have the latest source files, so you can download them from the following sites.

Apache download address: http://www.apachelounge.com/

1) click "Downloads" in the right column 」

2) click httpd-2.4.16-win64-vc14.zip.pdf. If it is a 32-bit system, click httpd-2.4.16-win32-vc14.zip 」.

Save the downloaded program to any folder.

Install Visual C ++ Redistributable for Visual Studio 2012 Update 4

Visual C ++ Redistributable for Visual Studio 2012 Update 4 must be installed when Windows server is not installed for some reasons.
1) access the following URL

Http://www.microsoft.com/zh-CN/download/details.aspx? Id = 30679

2) click "Download 」

3) Select "VSU4 \ vcredist_x64.exe" for the 64-bit system, select "VSU4 \ vcredist_x86.exe" for the 32-bit system, and click "Next 」.

Download an object to any folder.

4) after the download is complete, double-click the file and click "run 」

5) after reading the MICROSOFT software license terms, check "my uniform license terms and conditions (A)" and click "install 」

6) confirm "setting successful" and click "close 」

1) decompress the file

Decompress the downloaded "httpd-2.4.16-win64-vc14.zip" file and copy the Apache24 directory to the "C: \ MiddleWare" directory to complete Apache installation.

2) configure Apache

Modify the httpd. conf file according to the directory where Apache is installed. The path to the httpd. conf file is "Apache installation directory \ Apache24 \ conf \ httpd. conf 」.

Httpd. conf is a text file, so use notepad to modify it. We recommend that you copy the original file before modifying httpd. conf for backup.

Modify installation directory parameters

First, check the 37 lines of the httpd. conf file.

ServerRoot "c:/Apache24"
Make the following changes based on the directory where Apache is installed.

ServerRoot "c:/MiddleWare/Apache24"
Also, modify the path near 242 rows, 359 rows, and 375 rows.

Before change (242 rows)

DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
Options Indexes FollowSymLinks

AllowOverride None

Require all granted
</Directory>
After the change (242 rows)

DocumentRoot "c:/MiddleWare/Apache24/htdocs"
<Directory "c:/MiddleWare/Apache24/htdocs">
Options Indexes FollowSymLinks

AllowOverride None

Require all granted
</Directory>
Before change (359 rows)

ScriptAlias/cgi-bin/"c:/Apache24/cgi-bin /"
After the change (359 rows)

ScriptAlias/cgi-bin/"c:/MiddleWare/Apache24/cgi-bin /"
Before change (375 rows)

<Directory "c:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
After the change (375 rows)

<Directory "c:/MiddleWare/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
Confirm the port used by Apache

Check that there are 58 lines near the httpd. conf file.

Listen 80
Port 80 is the default port of Apache. Generally, you do not need to modify the port number. However, if another application uses port 80, you must modify the port number.

Modify ServerName

Confirm the ServerName configuration for Row 3.

# ServerName www.example.com: 80
When it starts with #, this line is Annotated. It can be seen that the ServerName in the initial configuration file is invalid, but it is recommended to explicitly configure ServerName. For a public website, you must configure the domain name + Port. If the port is omitted, the Listen parameter is used. When running Apache locally, configure "localhost: 80" or "127.0.0.1: 80 」.

Perform the following configuration this time.

ServerName localhost: 80
After the httpd. conf file is configured, save it. You have completed the preparation before installing and running Apache.

Configure how to start Apache

Visit the service overview page. On Windows Server 2008, choose start> Administrative Tools> services 」. The default name after logging on to the service from Apache is "Apache2.4 」.

Double-click Apache2.4 to display Apache service-related properties.

The current "start type" is "automatic", which means that Apache is automatically started when the system is started. If you do not want to start Apache at startup, set "startup type" to "manual" when you manually start Apache as needed 」.

The current Apache is stopped. Click start to start Apache. You can also perform stop, pause, and resume operations. For example, the startup and stop operations described in Apache can also be performed on the command line.

1) start Apache through the command line

The first is to start Apache from the command line. The path for saving the execution file is "Apache installation directory \ Apache24 \ bi \ httpd.exe 」.

First, switch the directory to the directory where httpd.exe is stored and run the httpd command.

The command line page for running Apache is as follows.

Check whether Apache is running normally. Open the browser and enter "http: // localhost/". The following page appears, indicating that Apache is running properly.

When you stop Apache, enter Ctrl + C in the command line. The following figure shows that Apache is stopped.

2) start Apache as a Service
When starting Apache as a service, you need to log on to the service. If Apache is in the startup status, stop Apache, switch to the bin directory where Apache is installed, and run the "httpd-k install" command.
As shown below, it means to log on to the service by using Apache. However, only one operation is required to log on to the service.
Start Apache and run the "httpd-k start" command. If Apache is started normally, the command line is in the writable state.
Check whether Apache is started. Open the browser and enter "http: // localhost/". If the page is displayed, Apache is successfully started.
When you stop Apache started as a service, run "httpd-k stop" or "httpd-k shutdown" on the command line 」.
When you restart Apache, run "httpd-k restart" on the command line 」.
Delete Apache from service
You need to run "httpd-k uninstall" when you delete Apache from the service 」.

Now, we have introduced you to apache installation service configuration and startup. I hope this tutorial will help you.

 

Related Article

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

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.