centos-rhel服务器相关 / php / 未分类 · 2015年7月29日

nginx 403 forbidden

引起nginx 403 forbidden 一般是缺少索引文件 或者权限问题。
1,缺少index.html或者index.php文件
server {
listen 80;
server_name a.com;
index index index.php index.html index.htm;
root /www;
如果在/home/zhang/www下面没有index.php,index.html的时候,直接访问域名,找不到文件,会报403 forbidden
2,权限问题
因为权限问题引起的403,一般少遇到 网上很多人喜欢用 chmod -R 0777 webdir,连什么 dedecsm phpcms 也是这样教别人的 很明显是程序哥写的教程呀 在这里 evan建议不要用这个 虽然方便 但是不安全呀 ,而是直接用 chown -R nginxuser:nginxuser wedir
server {
listen 80;
server_name a.com;
index index index.php index.html index.htm;
root /www;
相关
php写错导致nginx 403 forbidden及分析过程