lnmp更改默认目录

lnmp下默认的根目录是/usr/share/nginx/html

很多时候我们都需要更改默认的目录,下面记录一下,以备后用

server {
    listen       80;
    server_name  localhost;
location / {
     # 这里需要改成我们指定的目录 root
/home/www; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ {
   # 这里需要改成我们指定的目录 root
/home/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; # 这里需要改成 $document_root fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

}

猜你喜欢

转载自www.cnblogs.com/JiangBigShrimp/p/10655772.html