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

 

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

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
        }

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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 @ 2020-05-07 10:37  YoungDeng  阅读(597)  评论(0编辑  收藏  举报