Skip to content

Instantly share code, notes, and snippets.

@casualjim
Created October 12, 2011 10:20
Show Gist options
  • Save casualjim/1280840 to your computer and use it in GitHub Desktop.
Save casualjim/1280840 to your computer and use it in GitHub Desktop.
upstream jetty {
server 127.0.0.1:12180;
}
server {
listen 80;
server_name www.api.backchat.io;
rewrite ^/(.*) http://api.backchat.io/$1 permanent;
}
server {
listen 80;
server_name api.backchat.io;
access_log /var/log/backchat/api.backchat.io-access.log;
error_log /var/log/backchat/api.backchat.io-error.log;
root /var/lib/backchat/webapp;
gzip_static on;
gzip_vary on;
try_files $uri/index.html $uri.txt $uri.html $uri @app;
location @app {
proxy_buffering on;
proxy_pass http://jetty;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 5m;
}
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/ssl/certs/wildcard.backchat.io.combined.crt;
ssl_certificate_key /etc/ssl/private/wildcard.backchat.io.nopass.key;
server_name api.backchat.io;
access_log /var/log/backchat/api.backchat.io-access.log;
error_log /var/log/backchat/api.backchat.io-error.log;
root /var/lib/backchat/webapp;
gzip_static on;
gzip_vary on;
try_files $uri/index.html $uri.txt $uri.html $uri @app;
location @app {
proxy_buffering on;
proxy_pass http://jetty;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 5m;
}
}
server {
listen 443;
server_name www.api.backchat.io;
rewrite ^/(.*) https://api.backchat.io/$1 permanent;
}
@pietia
Copy link

pietia commented Oct 12, 2011

:)

@casualjim
Copy link
Author

it is just an example for someone on scalatra irc, we don't actually use nginx at this stage

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