我在amazon-linux中安装了nginx + passenger。截至rvmsudo passenger-install-nginx-module
我编辑/var/opt/nginx/nginx.conf
后如下:
root /home/ec2-user/current/public/index;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/ec2-user/current/public/index;
index index.html index.htm;
}
我已经抛出403禁止错误,因此,我检查了我的路径,这是正确的。
提前致谢
答案 0 :(得分:2)
您的权限过于严格,不允许Nginx访问您的根目录。放宽这样的权限:
chmod o+x /home/ec2-user/current
chmod o+x /home/ec2-user
答案 1 :(得分:1)
我认为你希望你的nginx配置只将根指向public
文件夹:
root /home/ec2-user/current/public;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/ec2-user/current/public;
index index.html index.htm;
}