Skip to content

Instantly share code, notes, and snippets.

@kenjones-cisco
Created December 6, 2016 21:07
Show Gist options
  • Save kenjones-cisco/4432af03b0ba3e0a35bd720f3ff3eb77 to your computer and use it in GitHub Desktop.
Save kenjones-cisco/4432af03b0ba3e0a35bd720f3ff3eb77 to your computer and use it in GitHub Desktop.
nginx if post get
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;
}
}
}
}