nginx 普通用户启动配置 && springboot-swagger 报错 Unable to infer base url
看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/
修改权限 /var/cache/nginx
sudo chmod a+w -R /var/cache/nginx
nginx]$ mkdir /var/cache/nginx/client_temp /var/cache/nginx/fastcgi_temp /var/cache/nginx/proxy_temp /var/cache/nginx/scgi_temp /var/cache/nginx/uwsgi_temp
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; }
如有帮当你,点个赞吧
启动命令也得改下,也要写成自己的conf
echo '#!/bin/bash
/usr/sbin/nginx -c /data/nginx/nginx.conf -e /data/nginx/log/error.log
' > nginx-start.sh
echo '#!/bin/bash
/usr/sbin/nginx -c /data/nginx/nginx.conf -e /data/nginx/log/error.log -s reload
' > nginx-reload.sh
mark。.
世界丰富多彩,知识天花乱坠。
---如果有帮到你,点个赞吧~
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)