(1)首先在current文件夹下新建服务有关的nginx配置文件nginx.conf
upstream news_server {
server unix:/tmp/unicorn.news.sock fail_timeout=0;
}
server {
listen 8888;
access_log /opt/app/ruby/news/current/log/nginx.access.log;
error_log /opt/app/ruby/news/current/log/nginx.error.log;
client_max_body_size 4G;
keepalive_timeout 5;
root /opt/app/ruby/news/current/public;
location ^~ /assets/ {
gzip on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;