Skip to content

Instantly share code, notes, and snippets.

@chroju
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save chroju/10534735 to your computer and use it in GitHub Desktop.

Select an option

Save chroju/10534735 to your computer and use it in GitHub Desktop.
Nginx、sites-availableに配置、Railsをサブディレクトリ下で展開するための設定
upstream unicorn-of-my-app {
server unix:/var/www/Rails-app/shared/tmp/sockets/unicorn.sock;
}
server {
listen 80;
server_name www.chroju.com 192.168.1.1;
root /var/www/home;
access_log /var/log/nginx/home.log;
error_log /var/log/nginx/home.log;
location /Rails-app {
alias /var/www/Rails-app/current;
try_files $uri $uri.html $uri/index.html @unicorn-of-my-app;
}
location @unicorn-of-my-app {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://unicorn-of-my-app;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment