默认情况下的 配置文件 是 /etc/nginx/conf.d 的default.conf的文件, /usr/share/nginx/html是根目录

 

 

在nginx.conf 的http最后的添加  include /etc/nginx/conf.d/*.conf;

 

conf.d 下新建**.conf

根据不同的端口号来访问端口号来访问不同的虚拟机 

 

server {
listen 80; 端口
server_name 192.168.20.30;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

location / {
root /var/www;
index index.html index.htm;
}

#error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /var/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           /var/nginx/html/123.com;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    }

 

posted on 2019-04-23 18:09  wang681  阅读(123)  评论(0)    收藏  举报