core/lib/generators/mno_enterprise/templates/scripts/nginx/app
upstream <%= app_name %>-backend {
server unix:/apps/<%= app_name %>/current/tmp/sockets/puma.sock fail_timeout=0;
}
# Rewrite http traffic to https
server {
server_name <%= app_name %>-mnoe.maestrano.io;
listen 80;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
}
server {
server_name <%= @app_domain %>;
listen 443;
ssl on;
ssl_certificate /etc/nginx/certificates/maestrano.io.wildcard-current/maestrano.io.wildcard.chained.crt;
ssl_certificate_key /etc/nginx/certificates/maestrano.io.wildcard-current/maestrano.io.wildcard.key;
root /apps/<%= app_name %>/current/public;
index index.html index.htm;
try_files $uri/index.html $uri.html $uri @backend;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location @backend {
expires -1;
add_header Cache-Control "max-age=0, no-store, must-revalidate";
proxy_set_header X-Forwarded-Proto https;
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_redirect off;
proxy_pass http://<%= app_name %>-backend;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}