当前位置:Gxlcms > PHP教程 > 通过修改本地的hosts,文件可以访问自己电脑的WEB服务器吗?

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

时间:2021-07-01 10:21:17 帮助过:15人阅读

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

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

       /bin/systemctl  iptables
       Unknown operation 'iptables'.
       setenforce 0

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

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

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

相关的apache配置

ServerName localhost:80

AllowOverride none
Require all denied

AllowOverride None
#Allow open access:
Require all granted

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

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted


回复内容:

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

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

       /bin/systemctl  iptables
       Unknown operation 'iptables'.
       setenforce 0

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

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

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

相关的apache配置

ServerName localhost:80

AllowOverride none
Require all denied

AllowOverride None
#Allow open access:
Require all granted

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

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted


可以的,
hosts
127.0.0.1 www.test.com

apache conf


    DocumentRoot "D:/web/www"
    ServerName www.test.com
    
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        Allow from 127.0.0.1
        Deny from all
        Require all granted
    

人气教程排行