Apache 不提供子域映像


Apache not serving subdomain images

我的服务器上有"Apache 2.4.6(Ubuntu)"和"PHP 5.5.4-1(cli)",我已经设置了一个运行PHP脚本的子域,运行PHP脚本,但没有显示任何图像。我已经在网络浏览器中输入了图像的URL,它只是坐在那里加载了很长时间。

我一直在玩我的站点可用的配置文件,但似乎无法显示它们。我没有.htaccess文件阻止图像或类似的东西。

这是我的子域名.domain.com.conf文件(经过编辑,不提供任何细节):

# domain: subdomain.domain.com
# public: /home/username/public/domain.com/subdomain/public
<VirtualHost subdomain.domain.com:80>
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory "/home/username/public/domain.com/subdomain/public">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  </Directory>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin webmaster@domain.com
  ServerName  www.subdomain.domain.com
  ServerAlias subdomain.domain.com
  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/username/public/domain.com/subdomain/public
  # Log file locations
  LogLevel warn
  ErrorLog  /home/username/public/domain.com/log/error.log
  CustomLog /home/username/public/domain.com/log/access.log combined
</VirtualHost>

当我尝试查看: subdomain.domain.com/elements/img/test.png

浏览器只是坐在他们的加载...

我是否在寻找正确的位置来解决此问题?我应该检查其他配置文件吗?我的域.com.conf文件是否以某种方式弄乱了子域?

谢谢,感谢您的所有帮助!

我认为

您的问题是您不使用基于名称的虚拟主机。除非您每个主机都有单独的 IP?

尝试将虚拟主机更改为:

<VirtualHost *:80>

您可能还需要更改主主机,但这一切都在 Apache 文档中进行了解释。

希望它能帮助你前进。