我试图将nginx配置为图像服务器,如下所示
创建myapp.conf并将其放在/etc/nginx/conf.d
server {
listen 80;
listen [::]:80;
#here you could also use subdomain
server_name image.mydomain.com ;
#here you could also use context,e.g. location /<context>
location / {
root /myapp/imageServer/;
autoindex on;
}
}
该文件存在于/myapp/imageServer/cad/3cdad37c5a394567b53283321f6af9e9.png
但是当我通过https://image.mydomain.com/card/3cdad37c5a394567b53283321f6af9e9.png.我得到403禁止使用nginx。我的nginx配置有什么错误吗?
我找到的原因
转到/etc/nginx/nginix.conf
编辑行如下
#user www-data;
user root;