cd /usr/local/nginx/conf

mkdir vhosts

cd vhosts

vim default.conf

server

{

    listen 80 default_server;

    server_name localhost;

    index index.html index.htm index.php;

    root /tmp/123;

deny all

    location ~ \.php$ {

        include fastcgi_params;

        fastcgi_pass unix:/tmp/php-fcgi.sock;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

    }


}

mkdir /tmp/123

/etc/init.d/nginx reload 重新加载配置文件




标准配置

server

{

    listen 80;

    server_name localhost;

    index index.html index.htm index.php;

    root /usr/local/nginx/html;


    location ~ \.php$ {

        include fastcgi_params;

        fastcgi_pass unix:/tmp/php-fcgi.sock;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

    }


}