vi /usr/local/nginx/conf/nginx.conf将其中的
location / {roothtml;index index.php index.html index.htm;}改为
location / {root/home/fuxiao/www;index index.php index.html index.htm;}然后再将
location ~ .php$ {roothtml;fastcgi_pass127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;includefastcgi_params;}改为
location ~ .php$ {root/home/fuxiao/www;fastcgi_pass127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;includefastcgi_params;}然后重新启动Nginx,网站根目录就已经是我们的家目录下的www。
解决方法
开始以为是自己访问的网页不具有读权限,于是给网页授予了读权限,但更改后再次访问依旧是该错误,试了多种方法后发现问题出在/home/fuxiao目录的fuxiao不具备读权限,即我们普通用户起初不具备读权限,只需给该目录赋予读权限即可解决该403问题。
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。