看nginx-error日志为:
2022/01/04 08:50:55 [crit] 8715#8715: *107201 mkdir() "/var/cache/nginx/proxy_temp/3" failed (13: Permission denied) while reading upstream, client: 192.168.181.166, server: localhost, request: "GET /prod-api/swagger-ui/swagger-ui-standalone-preset.js?v=3.0.0 HTTP/1.1", upstream: "http://[::1]:8090/swagger-ui/swagger-ui-standalone-preset.js?v=3.0.0", host: "hostname:9000", referrer: "http://hostname:9000/prod-api/swagger-ui/index.html".
发现没有 /var/cache/nginx/proxy/temp权限。 授权即可。
sudo chmod a+w /var/cache/nginx/proxy_temp -R
==========https://www.cnblogs.com/java2sap/p/15761224.html
另附: nginx yum安装&普通用户使用(普通用户不能用0-1024之间端口)
转自:https://www.leelib.com/2014/10/31/yum-install-last-nginx.html
添加nginx的repo
echo '[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/x86_64
gpgcheck=0
enabled=1' > /etc/yum.repos.d/nginx.repo
安装
yum update
yum install nginx
是不是直接安装了最新版的nginx呢 :)
log]$ whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
然后需要配置 nginx的普通用户路径. 创建相关目录,拷贝配置文件。授权proxy_temp . 如上。
log]$ mkdir -p /data/nginx/log /data/nginx/run /data/nginx/conf.d
log]$ cp /etc/nginx/nginx.conf /data/nginx/
log]$ cp /etc/nginx/conf.d/default.conf /data/nginx/conf.d/
sudo chmod a+w /var/cache/nginx/proxy_temp -R
log]$ vi /data/nginx/nginx.conf
#user nobody; worker_processes auto; error_log /data/nginx/log/error.log notice; pid /data/nginx/run/nginx.pid; events { use epoll; worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /data/nginx/log/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /data/nginx/conf.d/*.conf; }
如有帮当你,点个赞吧
mark。.