How to configure Apache server

青灯夜游
Release: 2019-06-14 13:09:04
Original
7997 people have browsed it

How to configure the Apache server? The following article briefly introduces the process of Apache configuration, I hope it will be helpful to you.

How to configure Apache server

Configuration process:

1. Open the httpd.conf file

Apache configuration is mainly concentrated in the httpd.conf file , which is located in your installation directory.

For example, my file path is: C:\wamp\bin\apache\Apache2.2.21\conf\httpd.conf

Use Notepad to open the file.

You can also find the httpd.conf file at the location in the picture below.

2. Configure the root directory of the website

Use Edit - Search to find DocumentRoot:

Find the location of the picture above and modify the text after DocumentRoot to configure the root directory of a website. The configuration here is to tell Apache where the root directory of your website is. For example, I configured the root directory to the www folder of the D drive.

Then continue to search down

Make the same changes to the text after Directory. Remember that the path here must be the same as the root directory you configured. The paths are consistent. The configuration here is to configure some permissions on your root directory.

3. Turn on the auxiliary configuration

Findhttpd-vhosts Locate the location in the picture above and change the previous # Remove the sign, the # sign indicates the meaning of a comment. save document. Removing the # sign here indicates that we have enabled an auxiliary configuration. This auxiliary configuration is a file and needs to be found to modify it.

This file is in your installation directory:

wamp\bin\apache\Apache2.2.21\conf\extra\httpd-vhosts.conf

Open with notepad, there are two templates at the bottom of the file:

The two templates are the same, copy one at will and put it in both In front of the template (do not modify the template), only modify three places in the text you copied:

(1) DocumentRoot: Modify the path here to the path where your project is located.

Example: DocumentRoot "D:/www/phpzww", remember to put your project file in the root directory you configured in the httpd.conf file.

(2) ServerName: Example: ServerName phpzww.com Domain Name

(3) ServerAlias: Example: ServerAlias ​​www.phpzww.com Alias ​​

Save the file and restart Apache.

4. Configure the corresponding IP address

At this time, the configured domain name cannot be accessed. We also need to configure the corresponding IP address.

In the pathC:\Windows\System32\drivers\etc Find the hosts file and open it with Notepad

Add the following content after the text:

127.0.0.1 phpzww.com

127.0.0.1 www.phpzww.com

Save the file

Remember not to add the # sign, adding the # sign indicates a comment I mean, it's useless.

Avoid using Chinese directories. At this point, the Apache server configuration and deployment are completed. If you have new projects, just follow the above method to configure them.

The above is the detailed content of How to configure Apache server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!