nginx 配置文件备份

#运行NGINX所使用的用户和组
user www www;

#NGINX进程数,建议按照CPU数目来定,一般按照它的倍数,每个进程消耗约10M内存
worker_processes 4;

#日志信息
error_log /usr/local/nginx/logs/error.log;
pid /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 65535;

events {
        #使用epoll的I/O模型
        use epoll;
        #该值守系统进程最大打开文件数限制,需要使用命令ulimit -n查看
        worker_connections 65535;
}



http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    sendfile on;
    keepalive_timeout 60;
    tcp_nodelay on;
    tcp_nopush     on;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    gzip on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;



    server {
        listen       80;
        server_name  www.islowlife.net;
        ##root        /home/webserver/website/islowlife/;
        ##index  html/tindex.html;
        location / {
            index  html/tindex.html;
            root        /home/webserver/website/islowlife/;
        }
        location ~.*.(jsp|do|action)$ {
            proxy_pass http://localhost:8000;
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        } 
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    server {
        listen       80;
        server_name image.zhuoyouapp.com;
        ##root        /home/webserver/website/islowlife/;
        ##index  html/tindex.html;
        location ~ .(html|js|css|jpg|jpeg|png|gif|xml)$ {
            root        /home/webserver/website/ZY_Part_1_V1/iosFile/softwareConfig/;
            expires      30d;
        }

        location / {
            proxy_pass http://localhost:8000;
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        } 
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    server {
        listen       8081;
        server_name  localhost;

        location ~ .(html|js|css|jpg|jpeg|png|gif|xml)$ {
            root        /home/webserver/website/;
            expires      30d;
        }

        location / {
            proxy_pass http://localhost:8001;
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }

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

    server {
        listen       8080;
        server_name  localhost;

        location ~ .(html|js|css|jpg|jpeg|png|gif)$ {
            root	/home/webserver/website/;
            expires      30d;
        }

        location / {
            proxy_pass http://localhost:8000;
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }

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

    server {
        listen       80;
        server_name  42.121.119.146;

        location ~ .(html|js|css|jpg|jpeg|png|gif)$ {  
            root	/home/webserver/website/;
            expires      30d;
        }  

        location / {  
            proxy_pass http://localhost:8000;
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        } 

        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;
    #    }
    #}

}

  

原文地址:https://www.cnblogs.com/angryprogrammer/p/4210205.html