網(wǎng)站首頁 編程語言 正文
一、由于啟動(dòng)用戶和nginx工作用戶不一致所致
1.1查看nginx的啟動(dòng)用戶,發(fā)現(xiàn)是nginx,而為是用root啟動(dòng)的
[root@iZwz96xkbmh1v1n08cvb5dZ /]# ps aux|grep nginx
root 2773 0.0 0.0 9068 844 ? Ss 13:56 0:00 nginx: master process /usr/sbin/nginx
nginx 2774 0.0 0.1 9476 2360 ? S 13:56 0:00 nginx: worker process
root 2916 0.0 0.0 221460 836 pts/0 R+ 13:59 0:00 grep --color=auto nginx
1.2將nginx.config的user改為和啟動(dòng)用戶一致,
命令:vim etc/nginx.conf
# For more information on configuration, see:
# ? * Official English Documentation: http://nginx.org/en/docs/
# ? * Official Russian Documentation: http://nginx.org/ru/docs/
user root; //就是這里
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
1.3 也可以使用如下命令直接查看
ps aux|grep nginx
[root@iZwz96xkbmh1v1n08cvb5dZ nginx]# ps aux|grep nginx
root 2983 0.0 0.0 9068 848 ? Ss 14:02 0:00 nginx: master process /usr/sbin/nginx
root 2984 0.0 0.1 9476 2356 ? S 14:02 0:00 nginx: worker process
root 2986 0.0 0.0 221460 848 pts/0 R+ 14:02 0:00 grep --color=auto nginx
二、缺少index.html,就是配置文件中index index.html index.htm這行中的指定的文件。
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /root/xiaoaodi/index/dist;
index index.html;
}
如果在/data/www/下面沒有index.html的時(shí)候,直接文件,會(huì)報(bào)403 forbidden。
三、權(quán)限問題,如果nginx沒有web目錄的操作權(quán)限,也會(huì)出現(xiàn)403錯(cuò)誤。
解決辦法:修改web目錄的讀寫權(quán)限,或者是把nginx的啟動(dòng)用戶改成目錄的所屬用戶,重啟Nginx即可解決
chmod -R 777 /data
chmod -R 777 /data/www/
[root@iZwz96xkbmh1v1n08cvb5dZ data]# chmod 777 www
[root@iZwz96xkbmh1v1n08cvb5dZ data]# ls -l
total 4
drwxrwxrwx 3 root root 4096 Apr 10 14:26 www
總結(jié)
原文鏈接:https://blog.csdn.net/qq_46087622/article/details/124080391
相關(guān)推薦
- 2022-08-11 GoFrame基于性能測(cè)試得知grpool使用場(chǎng)景_Golang
- 2022-09-16 Python中的socket網(wǎng)絡(luò)模塊介紹_python
- 2022-06-22 C++深入刨析muduo中的抽象類Poller_C 語言
- 2021-12-03 Apache?Log4j2?報(bào)核彈級(jí)漏洞快速修復(fù)方法_Linux
- 2022-06-04 Qt實(shí)現(xiàn)自定義驗(yàn)證碼輸入框控件的方法_C 語言
- 2022-05-03 C#設(shè)計(jì)模式之簡單工廠模式_C#教程
- 2022-07-24 詳解Flutter中StatefulBuilder組件的使用_Android
- 2022-02-28 Error: clean-webpack-plugin only accepts an option
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支