linux's docs

26.3.0: NGINX配置-虚拟主机


0. 虚拟主机配置

1) 主配文件配置

# vi /usr/local/nginx/conf/nginx.conf
*****************************************
    include /usr/local/nginx/conf/vhost/nginx-vhost.conf;
*****************************************

2) 虚拟主机文件配置

vi /usr/local/nginx/conf/vhost/nginx-vhost.conf
*****************************************
    server {
        listen 80;
        server_name www.301r.com 301r.com;
        root /data/www;
        index  index.html index.htm index.php;
        location ~ \.php$ {
            root           /data/www;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /data/www$fastcgi_script_name;
            include        fastcgi_params;
                }
        }
*****************************************

Contents