瀏覽代碼

添加 'conf.d/template.conf'

fanyijian 3 年之前
父節點
當前提交
d3f16a6ecc
共有 1 個文件被更改,包括 27 次插入0 次删除
  1. 27 0
      conf.d/template.conf

+ 27 - 0
conf.d/template.conf

@@ -0,0 +1,27 @@
+server {
+    listen 80;
+    server_name shop-wechat.xinyuesite.com;
+    charset utf-8;
+
+    add_header Access-Control-Allow-Origin *;
+    add_header Access-Control-Allow-Headers *;
+    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
+    if ($request_method = 'OPTIONS') {
+        return 204;
+    }
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    proxy_set_header Remote_addr $remote_addr;
+    proxy_set_header X-Real_IP $remote_addr;
+    proxy_set_header Host $host;
+    proxy_set_header X-CROS true;  # 自定义,有做跨域的时候需要加,后端会做判断
+    proxy_redirect off;
+    proxy_http_version 1.1;
+
+
+    location / {
+        root /usr/share/nginx/html/;
+        try_files $uri $uri/ /index.html;
+        index index.html;
+    }
+
+}