Skip to content

Instantly share code, notes, and snippets.

@huglester
Forked from raskhadafi/mailcatcher.conf
Last active August 29, 2015 14:06
Show Gist options
  • Save huglester/440112f66de3a1e39f56 to your computer and use it in GitHub Desktop.
Save huglester/440112f66de3a1e39f56 to your computer and use it in GitHub Desktop.
upstream mailcatcher {
sticky;
server appserver.domain.ch:3000 max_fails=1 fail_timeout=2s;
}
server {
listen 80;
server_name mailcatcher.domain.ch;
client_max_body_size 4G;
keepalive_timeout 5;
# Websocket messages
location /messages {
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
if ($host !~ 'mailcatcher.domain.ch') {
return 404;
}
proxy_pass http://mailcatcher;
break;
}
location / {
proxy_set_header Host $http_host;
proxy_redirect off;
if ($host !~ 'mailcatcher.domain.ch') {
return 404;
}
if (-f /root/mailcatcher/.maintenance) {
return 599;
}
if (!-f $request_filename) {
proxy_pass http://mailcatcher;
break;
}
}
include /etc/nginx/static/status.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment