Bladeren bron

chore: align api base urls with nginx proxy

ChenYu 4 maanden geleden
bovenliggende
commit
fe8dac59fe
3 gewijzigde bestanden met toevoegingen van 47 en 2 verwijderingen
  1. 1 1
      frontend/.env.production
  2. 1 1
      frontend/.env.staging
  3. 45 0
      frontend/test-hairstylist.aitori.jp.conf

+ 1 - 1
frontend/.env.production

@@ -1,2 +1,2 @@
 # Production API base URL for Vite build --mode production
-VITE_API_BASE_URL=https://hairstylist.aitori.com/api/v1
+VITE_API_BASE_URL=/api/v1

+ 1 - 1
frontend/.env.staging

@@ -1,2 +1,2 @@
 # Staging API base URL for Vite build --mode staging
-VITE_API_BASE_URL=https://test-hairstylist.aitori.com/api/v1
+VITE_API_BASE_URL=/api/v1

+ 45 - 0
frontend/test-hairstylist.aitori.jp.conf

@@ -0,0 +1,45 @@
+# 将HTTP请求重定向到HTTPS
+server {
+    listen 80;
+    server_name test-hairstylist.aitori.jp;
+    return 301 https://$server_name$request_uri;
+}
+
+# 配置HTTPS
+server {
+    listen 443 ssl;
+    server_name test-hairstylist.aitori.jp;
+
+    # SSL证书和密钥文件
+    ssl_certificate cert/test-hairstylist.aitori.jp.pem;
+    ssl_certificate_key cert/test-hairstylist.aitori.jp.key;
+
+    # SSL配置
+    ssl_session_timeout 5m;
+    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!aNULL:!MD5:!ADH:!RC4;
+    ssl_protocols TLSv1.2 TLSv1.3;
+    ssl_prefer_server_ciphers on;
+
+    root /data/www/bi/html;
+    index index.html;
+
+    # location 配置
+    location ^~ /api/ {
+        proxy_pass http://127.0.0.1:3000;
+        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_set_header X-Forwarded-Proto $scheme;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.html;
+    }
+
+    # 错误页面配置
+    error_page 404 /404.html;
+    location = /40x.html { }
+
+    error_page 500 502 503 504 /50x.html;
+    location = /50x.html { }
+}