【问题标题】:apache virtual host subdomains is accessable only by localhostapache 虚拟主机子域只能由 localhost 访问
【发布时间】:2015-09-26 23:37:36
【问题描述】:

我正在尝试让我的pic.localhost 虚拟主机可访问公共网络(所有互联网) 现在的问题是它只能在地址pic.localhost 的同一台机器上工作,但即使lan 网络也无法访问它,只能由运行它的机器访问。我该怎么办?

我添加并编辑了这些文件以使我的图片成为子域站点: 1 - 我将httpd-vhosts 文件包含在我的httpd.conf 文件中。 2 - 我在httpd-vhosts 文件中添加了这一行:

<VirtualHost *:80>
    ServerAdmin admin@domain
    DocumentRoot "/opt/lampp/htdocs/"
    ServerName pic.localhost
#    ServerAlias www.pic.localhost
    ErrorLog "logs/picture-error_log"
    CustomLog "logs/picture-access_log" common
</VirtualHost>

3 - 我将此行添加到/etc/hosts

127.0.0.1                pic.localhost

4 - 我重新启动了 xampp 服务器

我正在Centos 7 机器上运行xampp 5.6.8

【问题讨论】:

    标签: linux apache centos xampp virtualhost


    【解决方案1】:

    Centos 7 有一个防火墙,默认情况下阻止一些端口(包括端口 80)。 在命令行中,使用 sudo 权限尝试..

    service firewalld stop
    

    然后在终端看到你CENTOS LAN IP(ifconfig)并尝试访问该IP(例如192.168.1.100)。 如果您能够访问网络服务器。然后在另一台机器上尝试并在浏览器中提示 http://centos-lan-ip 其中 centos-lan-ip 是您的 centos 机器 IP。

    希望这可行

    【讨论】:

      猜你喜欢
      • 2014-03-15
      • 1970-01-01
      • 2011-10-31
      • 1970-01-01
      • 2022-01-12
      • 2015-05-27
      • 2014-12-28
      • 2015-02-24
      • 2013-12-14
      相关资源
      最近更新 更多