av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術(shù)文章
文章詳情頁

403-forbidden - Nginx更改Web根目錄導(dǎo)致403 Forbidden

瀏覽:65日期:2023-08-18 13:25:59

問題描述

1.背景服務(wù)器環(huán)境:CentOS7/Nginx1.10.0

2.問題更改Nginx的默認(rèn)Web根目錄之后,訪問網(wǎng)站出現(xiàn)403 Forbidden問題。

默認(rèn)目錄:/usr/share/nginx/html

[root@AllenServer html]# pwd /usr/share/nginx/html[root@AllenServer html]# ls -al總用量 16drwxr-xr-x. 2 allen allen 71 5月 29 01:45 .drwxr-xr-x. 5 allen allen 51 6月 1 14:47 ..-rw-r--r--. 1 allen allen 537 4月 26 23:11 50x.html-rw-r--r--. 1 allen allen 22 5月 29 01:45 index2.php-rw-r--r--. 1 allen allen 617 5月 29 01:23 index.html-rw-r--r--. 1 allen allen 167 5月 29 01:36 index.php

新目錄:/home/nginx/default

[root@AllenServer default]# pwd /home/nginx/default[root@AllenServer default]# ls -al總用量 16drwxrwxrwx. 2 nginx nginx 71 6月 2 17:15 .drwxrwxrwx. 3 nginx nginx 20 6月 1 16:10 ..-rwxrwxrwx. 1 nginx nginx 537 6月 1 16:11 50x.html-rwxrwxrwx. 1 nginx nginx 22 6月 1 16:11 index2.php-rwxrwxrwx. 1 nginx nginx 618 6月 2 17:15 index.html-rwxrwxrwx. 1 nginx nginx 167 6月 1 16:11 index.php

Nginx配置文件:

[root@AllenServer default]# more /etc/nginx/nginx.conf user nginx;#user root;worker_processes 1;error_log /var/log/nginx/error.log warn;pid/var/run/nginx.pid;events { 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 /var/log/nginx/access.log main; sendfileon; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf;}

網(wǎng)站配置文件:

[root@AllenServer conf.d]# more default.conf server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / {#root /usr/share/nginx/html;root /home/nginx/default;#root /test;index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html {#root /usr/share/nginx/html;root /home/nginx/default;#root /test; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ {#root /usr/share/nginx/html;root /home/nginx/default;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;includefastcgi_params; } # deny access to .htaccess files, if Apache’s document root # concurs with nginx’s one # #location ~ /.ht { # deny all; #}}

3.說明(1)更改配置之前訪問默認(rèn)的目錄是正常的;(2)更改配置之后重啟Nginx服務(wù);(3)更改新的Web根目錄之后訪問出現(xiàn)403問題。

請教各位大神如何解決這個問題?

問題解答

回答1:

權(quán)限問題一般是這么查的:

切換到出問題的軟件所使用的用戶。比如 su - nginx

嘗試從 / 開始一級級地進(jìn)入有問題的目錄

嘗試讀取文件

訪問一個文件時,不光要目標(biāo)文件的權(quán)限允許,還要它之上的各級目錄都允許的。

看哪一步報錯就知道是哪里的問題了。

另外注意一下你的權(quán)限除了基本 POSIX 權(quán)限外,還有 SELinux。你檢查一下,如果 SELinux 啟用了的話,要讓 SELinux 也允許 nginx 來訪問的。如果是 SELinux 引起的問題,SELinux 專門有個報告用的程序可以查看詳細(xì)信息的。

標(biāo)簽: web
相關(guān)文章:
主站蜘蛛池模板: 日本不卡高字幕在线2019 | 最新高清无码专区 | 精品国产欧美日韩不卡在线观看 | 国产欧美精品一区二区色综合朱莉 | 红桃视频一区二区三区免费 | 中文字幕中文字幕 | 黄色片视频免费 | 国产成都精品91一区二区三 | 81精品国产乱码久久久久久 | 中文字幕一区在线观看视频 | 国产日韩欧美一区二区在线播放 | 亚洲精品www| 亚洲在线 | 噜久寡妇噜噜久久寡妇 | 视频在线观看一区 | 精品视频网 | 2018国产大陆天天弄 | 国产精品一区二区免费看 | 黄色在线网站 | 国产精品亚洲一区二区三区在线 | 国产韩国精品一区二区三区 | 毛片在线看片 | 国产伦精品一区二区三区四区视频 | 日韩av美女电影 | 久久久久久国产精品免费免费男同 | 精品日韩一区 | 国产成人精品免费视频大全最热 | 99亚洲| 福利片在线看 | 日日操夜夜操天天操 | 日韩欧美国产精品一区 | 日韩精品一区二区三区中文在线 | 免费一区二区三区 | 亚洲最大av | 精品1区| 瑟瑟视频在线看 | 在线免费av观看 | 一区二区三区日本 | 久久在线| 狠狠色综合网站久久久久久久 | 午夜精品91 |