2023-08-24 17:47:45 +08:00
|
|
|
log_format apm '"$time_local" client=$remote_addr '
|
|
|
|
'method=$request_method request="$request" '
|
|
|
|
'request_length=$request_length '
|
|
|
|
'status=$status bytes_sent=$bytes_sent '
|
|
|
|
'body_bytes_sent=$body_bytes_sent '
|
|
|
|
'referer=$http_referer '
|
|
|
|
'user_agent="$http_user_agent" '
|
|
|
|
'upstream_addr=$upstream_addr '
|
|
|
|
'upstream_status=$upstream_status '
|
|
|
|
'request_time=$request_time '
|
|
|
|
'upstream_response_time=$upstream_response_time '
|
|
|
|
'upstream_connect_time=$upstream_connect_time '
|
|
|
|
'upstream_header_time=$upstream_header_time';
|
|
|
|
|
2022-07-08 11:02:33 +08:00
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name _;
|
2023-08-02 00:07:52 +08:00
|
|
|
root /app/nocobase/node_modules/@nocobase/app/dist/client;
|
2022-07-08 11:02:33 +08:00
|
|
|
index index.html;
|
2022-07-21 22:46:31 +08:00
|
|
|
client_max_body_size 20M;
|
2023-08-24 17:47:45 +08:00
|
|
|
access_log /var/log/nginx/nocobase.log apm;
|
2022-07-08 11:02:33 +08:00
|
|
|
|
2022-10-24 00:31:24 +08:00
|
|
|
gzip on;
|
2023-03-03 13:10:47 +08:00
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
|
|
|
|
# 不缓存 HTML 文件
|
|
|
|
location ~ \.html$ {
|
2023-03-06 12:00:12 +08:00
|
|
|
if_modified_since off;
|
|
|
|
expires off;
|
|
|
|
etag off;
|
2023-03-03 13:10:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# 缓存 JavaScript 和 CSS 文件
|
|
|
|
location ~* \.(js|css)$ {
|
2023-03-06 12:00:12 +08:00
|
|
|
expires 365d;
|
2023-03-03 13:10:47 +08:00
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
2022-10-24 00:31:24 +08:00
|
|
|
|
2022-07-08 11:02:33 +08:00
|
|
|
location /storage/uploads/ {
|
|
|
|
alias /app/nocobase/storage/uploads/;
|
2022-12-17 09:11:01 +08:00
|
|
|
add_header Cache-Control "public";
|
|
|
|
access_log off;
|
2022-07-08 11:02:33 +08:00
|
|
|
autoindex off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
2023-08-02 00:07:52 +08:00
|
|
|
root /app/nocobase/node_modules/@nocobase/app/dist/client;
|
2022-07-08 11:02:33 +08:00
|
|
|
try_files $uri $uri/ /index.html;
|
2022-12-17 09:11:01 +08:00
|
|
|
add_header Last-Modified $date_gmt;
|
|
|
|
add_header Cache-Control 'no-store, no-cache';
|
|
|
|
if_modified_since off;
|
|
|
|
expires off;
|
|
|
|
etag off;
|
2022-07-08 11:02:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
location ^~ /api/ {
|
|
|
|
proxy_pass http://127.0.0.1:13000/api/;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection 'upgrade';
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_cache_bypass $http_upgrade;
|
2022-12-09 07:06:00 +08:00
|
|
|
proxy_connect_timeout 600;
|
|
|
|
proxy_send_timeout 600;
|
|
|
|
proxy_read_timeout 600;
|
|
|
|
send_timeout 600;
|
2022-07-08 11:02:33 +08:00
|
|
|
}
|
2023-08-24 17:47:45 +08:00
|
|
|
|
2023-09-12 22:39:23 +08:00
|
|
|
location ^~ /static/plugins/ {
|
|
|
|
proxy_pass http://127.0.0.1:13000/static/plugins/;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection 'upgrade';
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_cache_bypass $http_upgrade;
|
|
|
|
proxy_connect_timeout 600;
|
|
|
|
proxy_send_timeout 600;
|
|
|
|
proxy_read_timeout 600;
|
|
|
|
send_timeout 600;
|
|
|
|
}
|
|
|
|
|
2023-08-24 17:47:45 +08:00
|
|
|
location /ws {
|
|
|
|
proxy_pass http://127.0.0.1:13000/ws;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "Upgrade";
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
}
|
2022-07-08 11:02:33 +08:00
|
|
|
}
|