Skip to content

Instantly share code, notes, and snippets.

@masahirosuzuka
Created August 26, 2013 16:24
Show Gist options
  • Save masahirosuzuka/6343429 to your computer and use it in GitHub Desktop.
Save masahirosuzuka/6343429 to your computer and use it in GitHub Desktop.
Rails3.2 + Nginx + Unicorn + Capisterno Nginx設定ファイル
user USERNAME;
worker_processes 2;
events {
worker_connections 1024;
}
http {
upstream unicorn {
server unix:/tmp/unicorn.sock; # アプリサーバのポート番号を指定
}
server {
include /etc/nginx/mime.types;
listen 80;
server_name raiqoo.com; # 待ち受けるドメインを指定
root /var/www/raiqoo/current/public;
access_log /var/log/access.log;
error_log /var/log/error.log;
proxy_connect_timeout 60;
proxy_read_timeout 60;
proxy_send_timeout 60;
include /etc/mginx/conf.d/*.conf;
include /etc/sites-enabled/*;
location / {
if (-f $request_filename) {
break;
}
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;
}
location ~ ^/assets/ {
root /var/www/raiqoo/current/public;
gzip_static on;
expires max;
add_header Cache-Control public;
}
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires 1y;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment