这是我第一次做这个项目,我的项目经理给我时间研究如何做。我来自谷歌和一些代码太复杂,有一个简单的方法怎么做?我猜也许并不太复杂。
答案 0 :(得分:0)
upstream app_server {
server unix:/var/run/unicorn.sock fail_timeout=0;
}
server {
listen 80;
root /home/rails/skreem-ror/public;
server_name 107.170.3.237 skreem.in www.skreem.in admin.skreem.in brands.skreem.in api.skreem.in;
index index.htm index.html;
location / {
try_files $uri/index.html $uri.html $uri @app;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {
try_files $uri @app;
}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 50M;
proxy_read_timeout 300;
}