Skip to content

Instantly share code, notes, and snippets.

@Aslan
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aslan/766db7119fc7cca21562 to your computer and use it in GitHub Desktop.
Save Aslan/766db7119fc7cca21562 to your computer and use it in GitHub Desktop.
upstream my_domain {
server unix:///home/ubuntu/apps/my_old_domain/shared/puma/my_old_domain.sock;
}
server {
listen 80;
server_name my.old_domain.com;
return 301 http://my.new_domain.com$request_uri;
}
server {
listen 80 default_server;
#listen 80 ;
client_max_body_size 4G;
server_name my.new_domain.com ;
keepalive_timeout 5;
index index.html index.htm index.php;
root /home/amsrv/apps/my_domain/current/public;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if (-f $request_filename) {
break;
}
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://my_domain; # match the name of upstream directive which is defined above
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/ubuntu/apps/my_domain/current/public;
}
} 5,1 25%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment