我的 nginx 配置

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
    log_format abc "$remote_addr|$remote_user|$time_local|$request_method|$uri|$args|$request_body|$server_protocol"
                   "|$status|$body_bytes_sent|$upstream_addr|$upstream_cache_status|$upstream_status"
                   "|$http_x_forwarded_for|$http_host|$http_user_agent|$upstream_response_time|$request_time";


    access_log  logs/access.log  abc;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    upstream carplay_dynamic{
      server 192.168.10.198:8080;
    }
    upstream monitor{
      server 192.168.10.198:8080;
    }
    upstream officedyanmic{
      server 192.168.10.139:8080;
    }
    upstream otcdyanmic{
#    server 192.168.10.133:8888;
#       server 10.0.0.2:8888;
#    server 192.168.10.21:8088;
#    server 192.168.10.103:8888;
#    server 192.168.10.100:8888;
#       server 10.0.0.1:8888;
#       server 2.0.0.1:8888;
    server 192.168.10.149:8888;
        

    }
    upstream  repair-master{
    #server 192.168.10.21:8081;
        server  192.168.10.56:8081;
    }
    upstream pmc{
        server www.ancenn.com;
    #server 192.168.10.89:8080;
    #server 192.168.10.89:8081;
    #server 192.168.10.21:6182;
    #server 192.168.10.132:8080;
        #server  192.168.10.133:8080;
        #server  192.168.10.56:8102;
    }
    upstream jk-site{
        server   192.168.10.100:9090;  
        #server  192.168.10.106:9090; 
        #server  192.168.10.56:8102; 
        #server  10.0.0.1:9090;
        #server  10.0.0.2:9090;
        #server  192.168.10.125:9090;
    }
    server {

        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location /carplay_dynamic {
            proxy_pass http://carplay_dynamic;
        }

    location /otcdyanmic {
            proxy_pass http://otcdyanmic;
        }
    location /officedyanmic{
            proxy_pass http://officedyanmic;
        }

    location /monitor {
            proxy_pass http://monitor;
        }
        location /repair-master {
            proxy_pass http://repair-master;
        }
        location /jk-site{
            proxy_pass http://jk-site;
            access_log  logs/host.access.log  abc;
        }
        location / {
            ssi    on;
            ssi_silent_errors on;
            root   html;
            index  index.html index.htm;
            access_log  logs/host.access.log  abc;
        }

     location /pmc {
            proxy_pass http://pmc;
        }
        
             

        #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   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           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$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;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    
     server {
        listen       8082;
        server_name  localhost 192.168.10.102 192.168.11.117 192.168.43.53 192.168.0.8;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
    error_log nginx_error.log debug;

        location / {
        root   D:/project/digital/digitalcampusweb;
            #root   /Users/shuwenjie/tellco/projects/zhidong1/digitalcampusweb;
            index  index.html index.htm;
        client_max_body_size 1000000m;
        }

        location /api/ {
            proxy_pass http://192.168.10.100:9880/api/;#立群电脑
            #proxy_pass http://192.168.10.104:9880/api/;#火林电脑
        #proxy_pass http://192.168.11.131:8090/api/; #与存电脑
            #proxy_pass http://192.168.10.221:8081/api/;
        #proxy_pass http://xpg-test.jxszxy.cn/api/;
            client_max_body_size 1000000m;
        }
        
        location /hub/ {
            proxy_pass http://192.168.10.221:8081/dc-sso/;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


}

 

<!-- <include src="public/Header.html"></include> -->
<!-- <include src="public/Footer.html"></include> -->


Nginx配置SSI

如何在nginx上配置SSI
需要的选项主要是以下三个:
ssi: 默认值off,启用ssi时将其设为on
ssi_silent_errors: 默认值off,开启后在处理SSI文件出错时不输出错误提示"[an error occurred while processing the directive]"。
ssi_types: 默认是text/html,所以如果需支持html,则不需要设置这句,如果需要支持shtml则需要设置:ssi_types text/shtml
三个参数可以放在http, server或location作用域下。

posted @ 2018-01-28 22:37  huihui2014  阅读(155)  评论(0)    收藏  举报