Created
August 30, 2018 12:14
-
-
Save smallnest/b145ca0a2eb060e63428b6cfb1c15033 to your computer and use it in GitHub Desktop.
nginx if post get
This file contains hidden or 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
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
upstream myappget { | |
server 127.0.0.1:3000; | |
server 127.0.0.1:3001; | |
server 127.0.0.1:3002; | |
} | |
upstream myapppost{ | |
server 0.0.0.0:4000; | |
} | |
server { | |
listen 80; | |
server_name wendaodev.zhaopin.com; | |
access_log /var/www/html/quora//log/access.log; | |
error_log /var/www/html/quora/log/error.log; | |
root /var/www/html/quora/; | |
index index.html; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
try_files /system/maintenance.html $uri $uri/index.html $uri.html @ruby; | |
} | |
location @ruby { | |
if ($request_method = POST) | |
{ | |
proxy_pass http://myapppost; | |
break; | |
} | |
if ($request_method = GET ) | |
{ | |
proxy_pass http://myappget; | |
break; | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment