13916729435 发表于 2018-11-9 07:14:52

更改nginx网站根目录

  默认网站根目录为/usr/local/nginx/html,要将它改成/home/www
  vi /usr/local/nginx/conf/nginx.conf
  将其中的
  location / {
  root html;
  index index.php index.html index.htm;
  }
  改为
  location / {
  root /home/www;
  index index.php index.html index.htm;
  }
  然后再将
  location ~ \.php$ {
  root   html;
  fastcgi_pass127.0.0.1:9000;
  fastcgi_indexindex.php;
  fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
  include    fastcgi_params;
  }
  改为
  location ~ \.php$ {
  root   /home/www;
  fastcgi_pass127.0.0.1:9000;
  fastcgi_indexindex.php;
  fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
  include    fastcgi_params;
  }

页: [1]
查看完整版本: 更改nginx网站根目录