Skip to content

Instantly share code, notes, and snippets.

@raskhadafi
Last active May 2, 2017 14:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save raskhadafi/497e4d108e98aac26dca to your computer and use it in GitHub Desktop.
Save raskhadafi/497e4d108e98aac26dca to your computer and use it in GitHub Desktop.
Nginx configuration for mailcatcher
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;
}
location /status {
stub_status on;
access_log off;
}
location /upstatus {
check_status;
access_log off;
}
@scottalan
Copy link

What does your include /etc/nginx/static/status.conf; file look like?

@raskhadafi
Copy link
Author

Sorry for the delay! 😒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment