Last active
May 25, 2018 12:01
-
-
Save lawvs/4d28ea24548a8a027a84f163b863bec9 to your computer and use it in GitHub Desktop.
nginx配置
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- lua添加hearder | |
ngx.header['TEST']= test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 8080; | |
server_name 127.0.0.1; | |
#charset koi8-r; | |
#access_log logs/host.access.log main; | |
location / { | |
root html/www/dist; # 静态文件目录 | |
index index.html; | |
try_files $uri $uri/ /index.html; # 按顺序检查文件是否存在 都不存在则内部重定向到最后一个参数 | |
} | |
location /api { | |
# proxy_set_header Host $http_host; | |
add_header 'Access-Control-Allow-Origin' '*'; | |
if ($request_method ~* "OPTIONS") { # 响应OPTIONS | |
return 200; | |
} | |
# return 301 $scheme://domain.com$request_uri; # 301 跳转 | |
# 修改url参数 添加token | |
# set $args "$args&token=123456"; | |
proxy_pass http://127.0.0.1:5000/api; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
location /test { | |
return 200 "TEST"; | |
} | |
} | |
include vhost/*.host; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment