1
- server {
2
- listen 80 ;
3
- root /explore/html;
4
- index index.html;
5
- location /api/ {
6
- proxy_pass http://localhost:8080;
7
- proxy_set_header Host $host ;
8
- proxy_set_header X-Real-IP $remote_addr ;
9
- }
10
- location / {
11
- try_files $uri $uri / /index.html;
12
- }
13
- }
1
+ http {
2
+ include /etc/nginx/mime.types;
3
+ default_type application/octet-stream;
4
+ log_format main '$remote_addr - $remote_user [$time_local ] "$request " '
5
+ '$status $body_bytes_sent "$http_referer " '
6
+ '"$http_user_agent " "$http_x_forwarded_for "' ;
7
+
8
+ gzip on ;
9
+ gzip_vary on ;
10
+ gzip_min_length 1024 ;
11
+ gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
12
+ server {
13
+ listen 80 ;
14
+ root /explore/html;
15
+ index index.html;
16
+
17
+ access_log /var/log/nginx/access.log main ;
18
+ error_log /var/log/nginx/error.log;
19
+
20
+ add_header X-Frame-Options "SAMEORIGIN" always;
21
+ add_header X-XSS-Protection "1; mode=block" always;
22
+ add_header X-Content-Type-Options "nosniff" always;
23
+
24
+ location /api/ {
25
+ proxy_pass http://localhost:8080;
26
+ proxy_set_header Host $host ;
27
+ proxy_set_header X-Real-IP $remote_addr ;
28
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
29
+ proxy_set_header X-Forwarded-Proto $scheme ;
30
+ proxy_connect_timeout 60s ;
31
+ proxy_send_timeout 60s ;
32
+ proxy_read_timeout 60s ;
33
+ }
34
+
35
+ location / {
36
+ try_files $uri $uri / /index.html;
37
+ }
38
+
39
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
40
+ expires 1y;
41
+ add_header Cache-Control "public, immutable" ;
42
+ }
43
+ }
44
+ }
0 commit comments