Home  >  Article  >  Operation and Maintenance  >  How to set own ip address for apache

How to set own ip address for apache

步履不停
步履不停Original
2019-06-29 10:01:157856browse

How to set own ip address for apache

Steps for apache to set its own IP address:

1. Find the httpd.conf file in the conf folder in the apache installation directory. , open with Notepad or other text editing software.

How to set own ip address for apache

#2. Search for the line "Include conf/extra/httpd-vhosts.conf" in the file, remove the "#" in front of it, and enable the virtual host function.

How to set own ip address for apache

3. Find the httpd-vhosts.conf file in the conf/extra folder in the apache installation directory, and open it with Notepad or other text editing software.

How to set own ip address for apache

4. At the end of the file, add the following code and save it:

<VirtualHost *:80>
ServerName www.domain.com
DocumentRoot D:/www/domain
<Directory  "D:/www/domain">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Among them, 80 is the port of the server, and what follows ServerName is the domain name. What follows DocumentRoot and Directory is the directory where the website program is located.

How to set own ip address for apache

5. Find the hosts file of the server. Taking the Windows system as an example, edit it with Notepad or other text in the C:\windows\system32\drivers\etc directory. The software opens.

How to set own ip address for apache

#6. Add a line 126.63.36.3 www.domain.com at the end of the hosts file and save it. After restarting the service, you can access it through the domain name.

How to set own ip address for apache

For more technical articles related to Apache, please visit the Apache Tutorial column to learn!

The above is the detailed content of How to set own ip address for apache. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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