First, change the root directory
Nginx the default Web site root is/usr/local/nginx/html, change it to/home/fuxiao/www
To change the method:
Vi/usr/local/nginx/conf/nginx.conf
Will be one of the
Location/{
root html;
Index index.php index.html index.htm;
}
To
Location/{
root /home/fuxiao/www;
Index index.php index.html index.htm;
}
And then the
Location ~ \.php$ {
root html;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include fastcgi_params;
}
To
Location ~ \.php$ {
root /home/fuxiao/www;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include fastcgi_params;
}
Then restart Nginx, the site root directory is already in our home directory under the www.
Ii. resolution of 403 errors
However, after the change is completed to test, visit the Web page under www has been prompted 403 forbidden, the following figure
Solving method
Start to think that the page you are visiting does not have Read permission, so give the page Read permission, but after the change again access is still the error, tried a variety of methods found that the problem in the/home/fuxiao directory Fuxiao does not have read permission, that is, our ordinary users do not have Read permission at first, You can solve the 403 problem by simply giving the directory Read permission.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.