After Apache configures the virtual host, the problem of not being able to access localhost

【Foreword】

      After Apache configures a virtual host, it cannot access localhost, but can only be accessed by setting a virtual domain name.

      By turning localhost into a virtual domain name.

      Reference file: http://570109268.iteye.com/blog/2414410

 

【main body】

(1) Set up a virtual domain name

First set the virtual domain name localhost in httpd-vhosts.conf

<VirtualHost _default_:80>
   DocumentRoot "C:\phpStudy\"
   ServerName localhost       
</VirtualHost>

 

After Apache configures the virtual host, the problem of not being able to access localhost

(2) Comment out the line ServerName localhost:80 in the httpd.conf file

After Apache configures the virtual host, the problem of not being able to access localhost

(3) Don't forget to check whether the hosts file is bound to localhost pointing to 127.0.0.1, which will normally exist

After Apache configures the virtual host, the problem of not being able to access localhost

 

(4) The second important point is to comment out the ServerName localhost:80 of the httpd.conf file

 

 

 

 

 

 

 

 

 

 

 

.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326121528&siteId=291194637