Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- upstream web_rack {
- server 1.1.1.1:80;
- server 2.2.2.2:80;
- }
- server {
- listen 80;
- listen [::]:80;
- server_name domain.com;
- client_max_body_size 1G;
- # the server will close connections after this time
- keepalive_timeout 5;
- location / {
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto https;
- proxy_pass http://web_rack;
- }
- }
- upstream domain.com {
- server unix:/tmp/unicorn.theapp.socket
- fail_timeout=0;
- }
- server {
- listen 80;
- server_name domain.com;
- # replace this with your static Sinatra app files, root + public
- root /home/app/mainapp/current/public;
- # port to listen for requests on
- error_log /var/log/nginx-error.log;
- # maximum accepted body size of client request
- client_max_body_size 1G;
- # the server will close connections after this time
- keepalive_timeout 5;
- location ~ ^(js|images|css|fonts|views|assets)$ {
- root /home/app/mainapp/current/public;
- expires max;
- add_header Cache-Control public;
- log_not_found off;
- }
- location / {
- 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;
- # pass to the upstream unicorn server mentioned above
- proxy_pass http://domain.com;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement