|
@@ -0,0 +1,54 @@
|
|
|
+server {
|
|
|
+ listen 80;
|
|
|
+ server_name saas.niusenyun.com; # 替换为您的域名
|
|
|
+
|
|
|
+ access_log /var/log/nginx/malladmin_access.log;
|
|
|
+ error_log /var/log/nginx/malladmin_error.log;
|
|
|
+
|
|
|
+ root {{ deploy_path }}/backendui/dist-prod;
|
|
|
+ index index.html;
|
|
|
+
|
|
|
+ # 启用gzip压缩
|
|
|
+ gzip on;
|
|
|
+ gzip_min_length 1k;
|
|
|
+ gzip_buffers 4 16k;
|
|
|
+ gzip_comp_level 6;
|
|
|
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
+ gzip_vary on;
|
|
|
+
|
|
|
+ location / {
|
|
|
+ try_files $uri $uri/ /index.html;
|
|
|
+ expires 7d;
|
|
|
+ add_header Cache-Control "public, no-transform";
|
|
|
+ }
|
|
|
+
|
|
|
+ # 静态资源缓存设置
|
|
|
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
|
+ expires 30d;
|
|
|
+ add_header Cache-Control "public, no-transform";
|
|
|
+ }
|
|
|
+
|
|
|
+ location /admin-api/ { ## 后端项目 - 管理后台
|
|
|
+ proxy_pass http://localhost:48080/admin-api/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
|
|
|
+ proxy_set_header Host $http_host;
|
|
|
+ proxy_set_header X-Real-IP $remote_addr;
|
|
|
+ proxy_set_header REMOTE-HOST $remote_addr;
|
|
|
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
+ }
|
|
|
+
|
|
|
+ location /app-api/ { ## 后端项目 - 用户 App
|
|
|
+ proxy_pass http://localhost:48080/app-api/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
|
|
|
+ proxy_set_header Host $http_host;
|
|
|
+ proxy_set_header X-Real-IP $remote_addr;
|
|
|
+ proxy_set_header REMOTE-HOST $remote_addr;
|
|
|
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ # 禁止访问隐藏文件
|
|
|
+ location ~ /\. {
|
|
|
+ deny all;
|
|
|
+ access_log off;
|
|
|
+ log_not_found off;
|
|
|
+ }
|
|
|
+}
|