-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnginx.conf
63 lines (55 loc) · 1.43 KB
/
nginx.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
client_max_body_size 20m;
client_body_buffer_size 20m;
keepalive_timeout 65;
sendfile on;
tcp_nodelay on;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:2m;
gzip on;
gzip_static on;
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript;
gzip_proxied any;
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.0;
server {
listen 80;
# 服务器名称
server_name localhost;
location / {
root /var/www/html/home;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /admin {
index index.html index.htm;
alias /var/www/html/admin/;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:8000/api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# 定义 404 页面
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# 定义 50x 页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}