demopu教你Nginx 403 forbidden的解决办法

来自:http://www.demopu.com/?p=639

常见的,引起nginx 403 forbidden有二种原因,一是缺少索引文件,二权限问题。1,缺少index.html或者index.php文件[plain]view plaincopyserver {        listen       80;        server_name  localhost;        index  index.php index.html;        root  /var/www;  }   如果在/var/www下面没有index.php,index.html的时候,直接访问域名,找不到文件,会报403 forbidden。例如:你访问www.test.com而这个域名,对应的root指定的索引文件不存在。2,权限问题[plain]view plaincopyserver {            listen       80;        server_name  localhost;        index  index.php index.html;        root  /var/www;    }  这种情况下,当前用户对目录没有读的权限,这样就会报403错误了。解决办法:修改web目录的读写权限,或者是把nginx的启动用户改成目录的所属用户,重起一下就能解决。【注意】:修改完配置别忘了重启nginx服务

转载请注明:Demopu.com » centos系统故障-Nginx 403 forbidden的解决办法

时间: 2024-08-19 10:24:36

demopu教你Nginx 403 forbidden的解决办法的相关文章

Nginx 403 forbidden的解决办法

以下是我的Nginx配置: user root; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/oct

Apache2.4部署django出现403 Forbidden错误解决办法

前言:Apache部署django出现403 Forbidden错误最好要结合apache中的错误日志来观察出现何种错误导致出现403错误 下午百度了一下午没找到解决办法,试了n种方法,简直坑爹! 比如网页出现最多的解决办法是: <Directory E:/wamp/Apache24/www(你的工程路径)>           Order allow,deny           Allow from all       </Directory> 可惜这样改了后还是报403,最后

django下ajax请求403(FORBIDDEN)的解决办法

环境 django 1.8.3 错误描述 POST http://localhost:8000/ajax_query_data/ 403 (FORBIDDEN) 解决办法 django官方文档上如下内容: https://docs.djangoproject.com/en/dev/ref/csrf/#ajax AJAX While the above method can be used for AJAX POST requests, it has some inconveniences: yo

一个奇葩常见的问题 nginx 403 forbidden错误

今天安装dedecms,配置Nginx,然后生成一键生成静态页面,然后就没有然后了,所有栏目页面都显示nginx 403 forbidden. 一般来说nginx 的 403 Forbidden errors 表示你在请求一个资源文件但是nginx不允许你查看.403 Forbidden 只是一个HTTP状态码,像404,200一样不是技术上的错误.哪些场景需要返回403状态码的场景?1.网站禁止特定的用户访问所有内容,例:网站屏蔽某个ip访问.2.访问禁止目录浏览的目录,例:设置autoind

laravel部署在nginx 出现 nginx 403 forbidden 错误的处理

laravel部署在nginx 总是出现 nginx 403 forbidden 如果不是权限问题,也不是索引文件的问题.那就是,laravel的主目录指定错了.原来不能指定laravel程序的根目录.要指定在public目录. Nginx 服务器 location / { try_files $uri $uri/ /index.php?$query_string; } 版权声明:本文为博主原创文章,未经博主允许不得转载.

nginx大量TIME_WAIT的解决办法 netstat -n | awk &#39;/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}&#39;

vi /etc/sysctl.conf net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse=1 #让TIME_WAIT状态可以重用,这样即使TIME_WAIT占满了所有端口,也不会拒绝新的请求造成障碍 默认是0 net.ipv4.tcp_tw_recycle=1 #让TIME_WAIT尽快回收 默认0 net.ipv4.tcp_fin_timeout=30 /sbin/sysctl -p 让修改生效 nginx大量TIME_WAIT的解决办法 ne

nginx “403 Forbidden” 错误的原因及解决办法

nginx 的 403 Forbidden errors 表示你在请求一个资源文件但是nginx不允许你查看. 403 Forbidden 只是一个HTTP状态码,像404,200一样不是技术上的错误. 哪些场景需要返回403状态码的场景? 1.网站禁止特定的用户访问所有内容,例:网站屏蔽某个ip访问. 2.访问禁止目录浏览的目录,例:设置autoindex off后访问目录. 3.用户访问只能被内网访问的文件. 以上几种常见的需要返回 403 Forbidden 的场景. 由于服务器端的错误配

Nginx 403 forbidden多种原因及故障模拟重现

访问Nginx出现状态码为403 forbidden原因及故障模拟 1) nginx配置文件里不配置默认首页参数或者首页文件在站点目录下没有 1 index index.php index.html index.htm; 问题模拟示例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [[email protected] extra]# cat www.conf #www virtualhost by oldboy    server 

Nginx 403 forbidden原因及故障模拟重现

访问Nginx出现状态码为403 forbidden原因及故障模拟 1) nginx配置文件里不配置默认首页参数或者首页文件在站点目录下没有 index index.php index.html index.htm; 问题模拟示例: [[email protected] extra]# cat www.conf #www virtualhost by oldboy    server {        listen       80;        server_name  www.etiant