我的服务器上有“Apache 2.4.6 (Ubuntu)”和“PHP 5.5.4-1 (cli)”,并且我已经设置了一个工作正常的子域,运行 PHP 脚本,但没有任何图像显示。我已将图像的 URL 输入到网络浏览器中,但它只是在那里加载了很长时间。
我一直在使用我的站点可用配置文件,但似乎无法显示它们。我没有 .htaccess 文件阻止图像或类似的内容。
这是我的 subdomain.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
浏览器只是等待加载...
我正在寻找正确的地方来解决这个问题吗?我应该检查其他配置文件吗?我的domain.com.conf 文件是否以某种方式与子域混淆?
谢谢,感谢您的所有帮助!
最佳答案
我认为您的问题是您没有使用基于名称的虚拟主机。除非每个主机都有单独的 IP?
尝试将您的虚拟主机更改为:
<VirtualHost *:80>
您可能还需要更改您的主要主机,但这一切都在 Apache docs 中进行了解释。 .
希望对您有所帮助。
关于php - Apache 不提供子域图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19159682/