Put Nginx in front of Rails
parent
0823c79b54
commit
442a68bb21
@ -0,0 +1,28 @@
|
||||
upstream rails-server {
|
||||
server 127.0.0.1:3000 fail_timeout=0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
server_name _;
|
||||
|
||||
root /app/public;
|
||||
|
||||
client_max_body_size 16m;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/index.html $uri.html @rails;
|
||||
}
|
||||
|
||||
location @rails {
|
||||
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 $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://rails-server;
|
||||
proxy_redirect off;
|
||||
error_page 500 502 504 /500.html; # Rails error pages
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g "daemon off;"
|
||||
redirect_stderr=true
|
||||
|
||||
[program:rails]
|
||||
command=bundle exec rails server
|
||||
redirect_stderr=true
|
||||
directory=/app
|
Loading…
Reference in New Issue