Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
upstream tdiary.unicorn {
server localhost:8080;
}
server {
server_name igarashikuniaki.net;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/;
index index.html index.htm;
}
location = / {
rewrite ^ /diary/ redirect;
}
location = /diary {
rewrite ^ /diary/ redirect;
}
location = /tdiary {
rewrite ^ /diary/ redirect;
}
location ~ ^/tdiary {
rewrite ^/tdiary/(.*)$ /diary/$1 redirect;
}
location ~ ^/[0-9\-]+\.html$ {
rewrite ^ /diary$request_uri redirect;
}
location ~ ^/diary/ {
try_files $uri @unicorn;
}
location @unicorn {
rewrite /diary/([0-9\-]+)\.html$ /diary/index.rb?date=$1 last;
proxy_pass http://tdiary.unicorn;
}
}
server {
server_name www.igarashikuniaki.net;
rewrite ^ $scheme://igarashikuniaki.net$request_uri redirect;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.