如何更改nginx网站根目录
2017-02-24 12:19
141 查看
默认网站根目录为/usr/local/nginx/html,要将它改成/home/ftpUser/www
vi /usr/local/nginx/conf/nginx.conf
将其中的
location / {
root html;
index index.php index.html index.htm;
}
改为
location / {
root /home/ftpUser/www;
index index.php index.html index.htm;
}
然后再将
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;
}
改为
location ~ \.php$ {
root /home/ftpUser/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
然后重启nginx
vi /usr/local/nginx/conf/nginx.conf
将其中的
location / {
root html;
index index.php index.html index.htm;
}
改为
location / {
root /home/ftpUser/www;
index index.php index.html index.htm;
}
然后再将
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;
}
改为
location ~ \.php$ {
root /home/ftpUser/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
然后重启nginx
相关文章推荐
- 如何更改nginx网站根目录 以及解析php
- 更改nginx网站根目录
- Nginx 更改网站根目录教程 - 顺便解决403 Forbidden | File not found
- 更改nginx网站根目录
- 更改nginx的网站根目录
- 更改nginx网站根目录
- 更改nginx网站根目录
- 更改Nginx网站根目录以及导致的403 forbidden问题解决
- 1:wamp如何更改网站根目录DocumentRoot 2:php的error_log文件(txt)会每秒几十K增大
- nginx更改网站目录,端口等等的方法
- Nginx网站根目录更改及导致403 forbidden的问题解决
- Amh/Nginx更改网站根目录
- Amh/Nginx更改网站根目录
- 更改nginx网站根目录
- 更改Nginx网站根目录以及导致的403 forbidden问题解决
- nginx服务器更改网站根目录
- 如何配置nginx,从而可以访问网站根目录的文件
- Nginx网站根目录更改及导致403 forbidden的问题解决
- nginx更改网站目录,端口等等的方法
- 【荐】如何规划 Nginx 网站目录的权限(用户,用户组,ssh,sftp)