【问题标题】:Why isn't apache finding my index.php?为什么 apache 找不到我的 index.php?
【发布时间】:2015-06-12 18:39:04
【问题描述】:

我设置了一个 vagrant box 将访客 80 的端口转发到 8080 的主机,当我转到主机 8080 时,我得到 404 文件未找到。根据this answer,这似乎是一个符号链接问题,但我的符号链接设置正确:

vagrant@vagrant-ubuntu-trusty-64:/etc/apache2/sites-enabled$ ls -l
total 0
lrwxrwxrwx 1 vagrant vagrant 41 Apr  8 00:19 000-default.conf -> /etc/apache2/sites-available/default.conf

或者至少我很确定那是正确的。我的default.conf 看起来像这样:

<VirtualHost *:80>
  ServerAdmin webmaster@localhost

  DocumentRoot /var/www/dirty_bird

  # correct caching issue where edited images do not refresh http://www.mabishu.com/blog/2013/05/07/solving-caching-issues-with-vagrant-on-vboxsf/
  EnableSendfile off

  <Directory /var/www/dirty-bird>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/dirty-bird.error.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/dirty-bird.access.log combined
</VirtualHost>

当我做vagrant up 然后访问localhost::8080 我得到:404 File Not Found 我确信这很简单,但我不确定是什么。谷歌大多告诉我这是一个符号链接问题,但除非我的符号链接是错误的,否则不是这种情况。并且 apache 正在运行。

【问题讨论】:

  • 但是监听 8080 端口的 vhost 记录在哪里
  • 您不应该需要它(请提供文档),因为来宾机器 apache 在 80 上运行,我正在将该端口转发到 8080
  • 我认为您对端口以及 apache 的工作原理有错误的理解。我不知道你到底要转发什么到 8080,但是如果没有人在端口 8080 上监听它就像转发到无处可去。以及符号链接与 apache 的关系如何?现在,apache 正在侦听端口 80 - 如果您不更改它,它将在 8080 上工作。
  • 无论如何,命令“a2ensite dirty_bird”有效吗?读取 apache 的日志文件。

标签: php apache


【解决方案1】:

您的防火墙中是否打开了 8080 端口?
在您的 VirtualHost 中查看端口 80,更改为 8080。

<VirtualHost *:80>

【讨论】:

  • 这似乎是错误的。来宾机器将80端口转发给主机,也就是8080端口,apache在80端口的来宾机器上运行。同样被否决
猜你喜欢
  • 1970-01-01
  • 2020-08-16
  • 1970-01-01
  • 1970-01-01
  • 2018-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多