当我尝试在浏览器中打开我的网络服务器主页时,收到以下错误消息:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at 169.53.245.85 Port 80
我在Ubuntu 14.04上使用Passenger 4.0.58运行Apache 2.4.7。
这是我的网站配置文件:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/passenger/myapp/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/home/passenger/myapp/public">
Options FollowSymLinks
Require all granted
Options -MultiViews
</Directory>
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
以下是其他可能有用的数据:
rails@production:/sbin$ ps -ef | grep apache
root 28075 1 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28081 28075 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28082 28075 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28083 28075 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28084 28075 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28085 28075 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28134 28075 0 20:37 ? 00:00:00 /usr/sbin/apache2 -k start
rails 30258 19062 0 21:15 pts/1 00:00:00 grep --color=auto apache
rails@production:/sbin$ /usr/sbin/apache2 -V
[Sun Feb 08 21:15:10.917531 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sun Feb 08 21:15:10.917668 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sun Feb 08 21:15:10.917691 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sun Feb 08 21:15:10.917705 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sun Feb 08 21:15:10.917732 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Feb 08 21:15:10.930731 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Feb 08 21:15:10.930953 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Feb 08 21:15:10.930981 2015] [core:warn] [pid 30261] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Feb 08 21:15:10.931039 2015] [so:warn] [pid 30261] AH01574: module passenger_module is already loaded, skipping
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
这是来自apache2.conf的第74行:
Mutex file:${APACHE_LOCK_DIR} default
以下是应用程序文件夹的权限:
rails@production:/home/passenger$ ls -l
total 4
drwxrwxrwx 18 www-data www-data 4096 Feb 6 18:20 myapp
这是我认为变量设置正确的envvars文件:
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
我一直在摆弄这个有一段时间无济于事。我认为www-data用户的权限设置正确,这是我认为错误的。我不确定apache正在吐出的错误是怎么回事。谢谢你的帮助!