修改网站根目录
[root@admin /]# vim usr/local/nginx/conf/nginx.conf######################## default ############################
server {
listen 80;
server_name localhost;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/default;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
将标注红色的root路径,修改为自己想要使用的根目录路径即可(注意:有些路径不可取)
本文介绍了如何在CentOS系统中修改Nginx服务器的默认网站根目录。通过编辑default配置文件,将`root`指令的路径更改为所需的目录,以实现网站根目录的定制。同时,确保新路径的正确性和权限设置,以保证Nginx能正常服务。
673

被折叠的 条评论
为什么被折叠?



