sf-utils2 sf-utils2
版本v3.3.3-beta1
首页
  • 01.快速开始 🔥
  • 02.基础-Base
  • 03.对象-Object
  • 04.数组-Array
  • 05.方法-Function
  • 06.字符串-String
  • 07.数学-Math
  • 08.dom
  • 09.拓展
  • webpack5.x教程学习 (opens new window)
  • 例子
  • 教程 🔥
  • 例子配置
企业级后台模版 (opens new window)
版本v3.3.3-beta1
首页
  • 01.快速开始 🔥
  • 02.基础-Base
  • 03.对象-Object
  • 04.数组-Array
  • 05.方法-Function
  • 06.字符串-String
  • 07.数学-Math
  • 08.dom
  • 09.拓展
  • webpack5.x教程学习 (opens new window)
  • 例子
  • 教程 🔥
  • 例子配置
企业级后台模版 (opens new window)
  • Nginx配置

    • 教程🔥
    • 指南者留学nginx配置
    • 溧阳口腔nginx配置
    • 本地mac nginx配置
    • 阿里云服务器nginx配置
    • 匿名sit配置
    • 匿名uat配置

溧阳口腔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"';

    #access_log  logs/access.log  main;
    sendfile on;
    #tcp_nopush     on;
    server_tokens off;
    #keepalive_timeout  0;
    keepalive_timeout 65;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_comp_level 2;
    gzip_types text/plain
    application/javascript
    application/x-javascript
    text/css
    application/xml
    text/javascript
    application/x-httpd-php
    image/jpeg
    image/gif
    image/png;
    gzip_vary off;


    server {
        # listen 20001;
        listen 20001 ssl;
        server_name 127.0.0.1;
        ssl on;
        ssl_certificate /usr/local/nginx/cert/hlwyy.lyrmyy.com.crt; #这里是ssl key文件存放的绝对路径,根据自己的文件名称和路径来写
        ssl_certificate_key /usr/local/nginx/cert/hlwyy.lyrmyy.com.key; #这里是ssl key文件存放的绝对路径,根据自己的文件名称和路径来写
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 5m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        server_tokens off;
        add_header X-Content-Options "nosniff";
        add_header X-Frame-Options "DENY";
        add_header X-XSS-Protection "1; mode=block";
        add_header Strict-Transport-Security "max-age=15768000";
        proxy_cookie_path / "/; httponly; secure; SameSite=Strict";
        error_page 497 301 https://$http_host$request_uri;  # 重点

        if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})" ) {
            set $date $1$2$3;
        }

        # 日期记录日志
        access_log /usr/local/nginx/logs/$date.host.access.log;

        #错误日志
        # error_log   logs/error/$year-$month-$day-$hour.log;

        if ($host != 'hlwyy.lyrmyy.com' ) {
            return 500;
        }
        location / {
            proxy_pass http://hlwyy.lyrmyy.com:20000;
            # root html;
            # if ($request_filename ~* .*\.(?:htm|html)$) {
            #   add_header Cache-Control
            #     "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            #   add_header X-Content-Options "nosniff";
            #   add_header X-Frame-Options "DENY";
            #   add_header X-XSS-Protection "1; mode=block";
            #   # proxy_connect_timeout 600;
            #   # proxy_send_timeout 600;
            #   # proxy_read_timeout 600;
            # }
            # if ($request_filename ~* .*\.(?:js|css)) {
            #   expires 7d;
            # }
            # if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) {
            #   expires 7d;
            # }
            # index index.html index.htm;
        }

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        location ^~ /admin/ {
            root /zlk;
            if ($request_filename ~* .*\.(?:htm|html)) {
                add_header Cache-Control
                "private, no-store, no-cache, must-revalidate, proxy-revalidate";
                add_header X-Content-Options "nosniff";
                add_header X-Frame-Options "DENY";
                add_header X-XSS-Protection "1; mode=block";
            }
            if ($request_filename ~* .*\.(?:js|css)) {
                expires 7d;
            }
            if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) {
                expires 7d;
            }
            index /admin/index.html;
        }

        location ~ /main-api {
            rewrite ^/main-api/(.*)$ /$1 break;
            proxy_pass http://localhost:2001; # 主数据代理地址
            # 在这里设置
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_cookie_path / "/; httponly; secure; SameSite=Strict";
        }

        location ~ /h5/ {
            root /zlk;
            try_files $uri $uri/ /h5/index.html;
            if ($request_filename ~* .*\.(?:htm|html)) {
                add_header Cache-Control
                "private, no-store, no-cache, must-revalidate, proxy-revalidate";
                add_header X-Content-Options "nosniff";
                add_header X-Frame-Options "DENY";
                add_header X-XSS-Protection "1; mode=block";
            }
            if ($request_filename ~* .*\.(?:js|css)) {
                expires 7d;
            }
            if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) {
                expires 7d;
            }
        }

        location ^~ /zlk/files/image/ {
            alias /zlk/files/image/;
            if ($request_filename ~* .*\.(?:htm|html)$) {
                add_header Cache-Control
                "private, no-store, no-cache, must-revalidate, proxy-revalidate";
                add_header X-Content-Options "nosniff";
                add_header X-Frame-Options "DENY";
                add_header X-XSS-Protection "1; mode=block";
            }
        }


        location /MP_verify_m2qoYP0kcbviE0H1.txt {
            root /zlk/h5/certificate;
        }

        error_page  404              /40x.html;
        location = /40x.html {
            root html;
            if ($request_filename ~* .*\.(?:htm|html)$) {
                add_header Cache-Control
                "private, no-store, no-cache, must-revalidate, proxy-revalidate";
                add_header X-Content-Options "nosniff" always;
                add_header X-Frame-Options "DENY" always;
                add_header X-XSS-Protection "1; mode=block" always;
            }

        }

        # redirect server error pages to the static page /50x.html
        #

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root html;
            if ($request_filename ~* .*\.(?:htm|html)$) {
                add_header Cache-Control
                "private, no-store, no-cache, must-revalidate, proxy-revalidate";
                add_header X-Content-Options "nosniff" always;
                add_header X-Frame-Options "DENY" always;
                add_header X-XSS-Protection "1; mode=block" always;
                add_header  Nginx-Cache "$upstream_cache_status";
            }
        }

        location ^~ /zlk/files/ {
            add_header X-Content-Options "nosniff" always;
            add_header X-Frame-Options "DENY" always;
            add_header X-XSS-Protection "1; mode=block" always;
            add_header  Nginx-Cache "$upstream_cache_status";
            add_header                                             'Access-Control-Allow-Origin' '*';
            add_header                                             'Access-Control-Allow-Credentials' 'true';
            if ($request_method = OPTIONS) {
                add_header                                         'Access-Control-Allow-Origin' '*';
                add_header                                         'Access-Control-Allow-Credentials' 'true';
                add_header                                         'Access-Control-Max-Age' 1728000;
                add_header                                         'Access-Control-Allow-Credentials' 'true';
                add_header                                         'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
                add_header                                         'Access-Control-Allow-Headers' 'reqid, nid, host, x-real-ip, x-forwarded-ip, event-type, event-id, accept, content-type';
                return                                             200;
            }
            alias                                                  /zlk/files/;
        }
    }

    # 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  hlwyy.lyrmyy.com;
    #      ssl on;
    #      ssl_certificate  /usr/local/nginx/cert/hlwyy.lyrmyy.com.crt; #这里是ssl key文件存放的绝对路径,根据自己的文件名称和路径来写
    #      ssl_certificate_key  /usr/local/nginx/cert/hlwyy.lyrmyy.com.key; #这里是ssl 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;
    #      }
    #   }
}


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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
上次更新: 2022/12/30, 23:48:21
指南者留学nginx配置
本地mac nginx配置

← 指南者留学nginx配置 本地mac nginx配置→

Theme by Vdoing | Copyright © 2022-2025 bianpengfei
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×