I'm trying to redirect different URI requests to different EC2 containers, I've been using nginx for years as a catchall reverse proxy to apache but now I'd like to have some rewrites done at nginx level.
Here's what I'm trying to accomplish:
server { listen 80; server_name _; gzip on; gzip_static on; gzip_buffers 16 8k; gzip_comp_level 9; gzip_http_version 1.0; gzip_min_length 0; gzip_types text/plain text/css application/x-javascript; gzip_vary on; location / { # catch the following URI's including homepage: /contact.html, /terms.html, / 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_read_timeout 240; proxy_connect_timeout 240; proxy_send_timeout 240; send_timeout 240; proxy_pass http://servers_static; } location / { # catch everything not matched above 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_read_timeout 240; proxy_connect_timeout 240; proxy_send_timeout 240; send_timeout 240; proxy_pass http://servers_dynamic; } } I'm sure this just a simple regex issue, but I have never understood that stuff. Can someone help me out?