我无法使用nginx运行我的angular 4应用程序。我已经检查了错误.log对于nginx,我看到这个
2018/04/21 12:49:52 [错误] 13961#13961:*1 open(( "/root/test/myapp/web-portal/index.html"失败 (13: 权限被拒绝(
我正在使用 sudo 运行所有命令。我的 nginx 配置是
server {
listen 80 default_server;
listen [::]:80 default_server;
# Add index.php to the list if you are using PHP
root /root/test/myapp/web-portal/index.html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location /admin {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.html =404;
}
}
我试过 chmod,但对我不起作用
chmod -R 755 /root/test/myapp/web-portal
以根用户身份运行 nginx 不是一个很好的做法。
您应该为 nginx创建一个用户(如果您还没有用户(,然后将网站文件放在所有者是 nginx 用户的目录中,例如/var/www