Home  >  Article  >  Backend Development  >  I use wamp to run the php program. By default, localhost can access it. But if I change it to the local IP, it won’t work.

I use wamp to run the php program. By default, localhost can access it. But if I change it to the local IP, it won’t work.

WBOY
WBOYOriginal
2016-12-01 00:25:341880browse

localhost can access the local server
Changing to the local IP will not work, prompting a 403 error

Reply content:

localhost can access the local server
Changing to the local IP will not work, prompting a 403 error

Configure the hosts file 127.0.0.1 localhost ::1 localhost

Assume local IP: 192.168.31.81

hosts file

<code>127.0.0.1   192.168.31.81
</code>

httpd-vhosts.coonf

<code><VirtualHost *:80>  
    DocumentRoot "F:/wamp/www/XXXX/"
    ServerName 192.168.31.81
    <Directory "F:/wamp/www/XXXX/"> 
        Options Indexes FollowSymLinks 
        Order allow,deny 
        Allow from all 
    </Directory> 
</VirtualHost>
</code>
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