Nginx 常用配置模板

user root  root;

worker_processes auto;
worker_rlimit_nofile 51200;

events {
        use epoll;
        worker_connections 51200;
        multi_accept on;
}

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;
        client_max_body_size 1024m;

        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;
        tcp_nodelay on;

        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;

        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
        gzip_vary on;
        gzip_proxied   expired no-cache no-store private auth;
        gzip_disable   "MSIE [1-6]\.";

        server_tokens off;
        access_log off;

        include vhost/*.conf;
}

  

server
    {
        listen 80;
        #listen [::]:80;
        server_name homework.wfkids.net;
        return 301 https://$server_name$request_uri;

        access_log logs/homework80.log;
    }
server
        {
            listen 443;
            #listen [::]:80;
            server_name homework.wfkids.net;
            index index.html index.htm index.php default.html default.htm default.php;
            root  /home/static/pages/homework.wfkids.net;

            #error_page   404   /404.html;


            #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            #{
            #    expires      30d;
            #}

            #location ~ .*\.(js|css)?$
            #{
            #    expires      12h;
            #}

            location ~ /\.
            {
                deny all;
            }

        location /course
        {
                proxy_pass http://homework.wfkids.net/course;
        }

            access_log  logs/homework443.log;
        }

  

server
    {
        listen 80;
        #listen [::]:80;
        server_name 1111.wfkids.net;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/1111.wfkids.net;

        include none.conf;
        #error_page   404   /404.html;
        include enable-php.conf;

        #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        #{
        #    expires      30d;
        #}

        #location ~ .*\.(js|css)?$
        #{
        #    expires      12h;
        #}

        location ~ /\.
        {
            deny all;
        }

        location /wfcm-api
        {
                proxy_pass http://wfnx.wfkids.net/wfcm-api;
        }

        location /record
        {
                proxy_pass http://release.console.wf.pcein.com:28080/record;
        }
        location /mmopen{
                proxy_pass http://thirdwx.qlogo.cn/mmopen;
        }
        access_log off;
    }
server
        {
            listen 443;
            #listen [::]:80;
            server_name 1111.wfkids.net;
            index index.html index.htm index.php default.html default.htm default.php;
            root  /home/wwwroot/1111.wfkids.net;

            include none.conf;
            #error_page   404   /404.html;
            include enable-php.conf;

            #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            #{
            #    expires      30d;
            #}

            #location ~ .*\.(js|css)?$
            #{
            #    expires      12h;
            #}

            location ~ /\.
            {
                deny all;
            }

        location /wfcm-api
        {
                proxy_pass http://wfnx.wfkids.net/wfcm-api/;
        }

        location /record
        {
                proxy_pass http://release.console.wf.pcein.com:28080/record;
        }
        location /mmopen{
                proxy_pass http://thirdwx.qlogo.cn/mmopen;
        }
            access_log off;
        }

  

posted @ 2019-01-21 19:43  现世安稳。  阅读(431)  评论(0编辑  收藏  举报