centos nginx 之网站根目录路径修改

来源:互联网 发布:门户网站源码下载 编辑:程序博客网 时间:2024/05/17 03:19

修改网站根目录

[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路径,修改为自己想要使用的根目录路径即可(注意:有些路径不可取)

0 0