>백엔드 개발 >PHP 튜토리얼 >通过修改本地的hosts,文件可以访问自己电脑的WEB服务器吗?

通过修改本地的hosts,文件可以访问自己电脑的WEB服务器吗?

WBOY
WBOY원래의
2016-06-06 20:10:161473검색

我windows 配置hosts文件添加 dev.aidaogo.com
linux 的hosts 文件同样修改添加 dev.aidaogo.com

情况大致描述:
selinux 和防火墙都已经关闭了

<code>       /bin/systemctl  iptables
       Unknown operation 'iptables'.
       setenforce 0
</code>

windows ping dev.aidaogo.com 也是可以ping同的

linux wget dev.aidaogo.com 可以正常下载

netstat -nat
tcp6 0 0 :::80 :::* LISTEN

相关的apache配置

ServerName localhost:80

<code>AllowOverride none
Require all denied</code>

<code>AllowOverride None
#Allow open access:
Require all granted</code>

<code>ServerAdmin aidaogo
DocumentRoot /home/www/aidaogo/www
ServerName dev.aidaogo.com
ServerAlias aidaogo
ErrorLog logs/dev.aidaogo.com-error_log
CustomLog logs/dev.aidaogo.com-access_log common</code>

<code>    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted</code>


回复内容:

我windows 配置hosts文件添加 dev.aidaogo.com
linux 的hosts 文件同样修改添加 dev.aidaogo.com

情况大致描述:
selinux 和防火墙都已经关闭了

<code>       /bin/systemctl  iptables
       Unknown operation 'iptables'.
       setenforce 0
</code>

windows ping dev.aidaogo.com 也是可以ping同的

linux wget dev.aidaogo.com 可以正常下载

netstat -nat
tcp6 0 0 :::80 :::* LISTEN

相关的apache配置

ServerName localhost:80

<code>AllowOverride none
Require all denied</code>

<code>AllowOverride None
#Allow open access:
Require all granted</code>

<code>ServerAdmin aidaogo
DocumentRoot /home/www/aidaogo/www
ServerName dev.aidaogo.com
ServerAlias aidaogo
ErrorLog logs/dev.aidaogo.com-error_log
CustomLog logs/dev.aidaogo.com-access_log common</code>

<code>    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted</code>


可以的,
hosts
127.0.0.1 www.test.com

apache conf

<code><virtualhost>
    DocumentRoot "D:/web/www"
    ServerName www.test.com
    <directory>
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        Allow from 127.0.0.1
        Deny from all
        Require all granted
    </directory>
</virtualhost></code>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.