配置虛擬主機

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;

    }


}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章