upstream puma {
server unix:///var/www/phonebook-api/tmp/sockets/puma.sock;
}
server {
listen 80 default;
listen [::]:80 default ipv6only=on;
server_name 10.12.4.245;
charset utf-8;
root /var/www/phonebook-api;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
root phonebook-app/dist;
index index.html index.htm;
try_files $uri @app;
gzip_static on;
expires max;
proxy_read_timeout 150;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
location @app {
proxy_pass http://10.12.4.245;
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 http;
proxy_set_header Host $http_host ;
proxy_redirect off;
proxy_next_upstream error timeout invalid_header http_502;
}
client_max_body_size 50M;
keepalive_timeout 10;
}