nginx-config - Nginx 配置为图像服务器,但得到 403 禁止错误
问题描述
我尝试将 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/card/3cdad37c5a394567b53283321f6af9e9.png
但是当我通过https://image.mydomain.com/card/3cdad37c5a394567b53283321f6af9e9.png浏览这个文件时。我从 nginx 得到了 403 禁止。我的 nginx 配置有什么错误吗?
解决方案
我找到了原因
去 /etc/nginx/nginx.conf
编辑行如下
#user www-data;
user root;
推荐阅读
- swift - 如何在 SwiftUI 中移动到下一个 TextField?
- javascript - Parceljs 没有正确捆绑产品?
- java - 使用 if 语句查找 3 个变量中的最小值
- angular - Fullcalendar - 角度营业时间未显示
- javascript - I don't understand why my for loop return "undefined"
- python - 如何从子集中选择数据
- oop - 如何动态生成用于特征的值?
- python - Selenium 无法在 Instagram 上获取所有元素
- compiler-errors - 为什么临时变量会抑制“类型归属是实验性的”错误?
- ios - 如何动态更改本地化 SwiftUI