Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the Apache server

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the method of configuring Apache server, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

Configuration process: 1. Open the httpd.conf file

The configuration of Apache 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 of the following figure.

2. Configure the root directory of the website

Use Edit-find, find DocumentRoot:

Find the location of the image above and modify the text after DocumentRoot to configure the root directory of a website, which is configured to tell Apache where the root directory of your site is. For example, I configured the root directory under the www folder of D disk.

Then continue to look down.

Make the same changes to the text after Directory, and remember that the path here must be the same as the root path you configured. The purpose of this configuration is to configure the permissions of your root directory.

3. Enable auxiliary configuration

Find httpd-vhosts and navigate to the location above, and remove the previous #, which indicates the meaning of the comment. Save the file. The removal of the # here indicates that we have turned on an auxiliary configuration. This secondary configuration is a file that needs to be found for modification.

This file is in your installation directory:

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

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

The two templates are the same, make an arbitrary copy, put it in front of the two templates (do not modify the template), and only modify the text you copy in three places:

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

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

(2) ServerName: example: ServerName yisu.com domain name

(3) ServerAlias: example: ServerAlias www.yisu.com alias

Save the file and restart Apache.

4. Configure the corresponding IP address

At this time, the domain name of the access configuration is not accessible, and we also need to configure the corresponding IP address.

Find the hosts file in the path C:\ Windows\ System32\ drivers\ etc and open it with notepad

Add the following after the text:

127.0.0.1 yisu.com

127.0.0.1 www.yisu.com

Save Fil

Remember not to add a # sign, plus a # sign to indicate the meaning of a comment, it is useless.

Avoid using Chinese catalogs. At this point, the configuration and deployment of the Apache server is complete, and any new projects can be configured according to the above method.

Thank you for reading this article carefully. I hope it will be helpful for everyone to share the methods and contents of configuring Apache server. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report