【发布时间】:2016-11-14 23:47:27
【问题描述】:
我正在尝试通过端口 5000 上的Passenger-Nginx 运行我的应用程序
在我的浏览器上我得到“403 Forbidden”和我的 nginx 错误日志:
2016/07/12 17:52:12 [错误] 28924#0: *1 目录索引 “/var/www/cava/public/”被禁止,客户端:Y.Y.Y.Y,服务器: cava,请求:“GET / HTTP/1.1”,主机:“X.X.X.X:5000”
在乘客根上,我使用从 passenger-config --root 获得的内容,但没有使用 rvm。 如果我在加载 rvm 的情况下使用乘客根,我会收到乘客错误,但我在这里做的对吗?
供参考我的应用配置和我的 nginx.conf:
我的应用配置
server {
listen 5000;
listen [::]:5000;
server_name cava;
root /var/www/cava/public;
#try_files $uri/index.html $uri @app;
# Add index.php to the list if you are using PHP
#index index.html index.htm index.nginx-debian.html;
#location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
#}
}
我的 nginx.conf
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/tasos/.rvm/rubies/ruby-2.3.0/bin/ruby;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
server {
passenger_enabled on;
listen 443 ssl;
root /usr/share/nginx/html;
index index.html index.htm;
ssl_certificate /etc/nginx/ssl/1_beast.smartupweb.com_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/smartup1.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL;
#location / {
# try_files $uri $uri/ =404;
#}
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
任何帮助表示赞赏。
【问题讨论】:
-
ls -lad /var/www/cava/public的输出是什么? -
@mudasobwa 输出为
drwxrwxr-x 5 tasos tasos 4096 Jul 5 15:18 /var/www/cava/public
标签: ruby-on-rails ruby nginx passenger