Open c-lliope opened 7 years ago
config/nginx.conf
taken from:
https://www.digitalocean.com/community/tutorials/docker-explained-how-to-containerize-and-use-nginx-as-a-proxy
daemon off;
worker_processes 1;
events { worker_connections 1024; }
http {
sendfile on;
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript
application/x-javascript
application/atom+xml;
# List of application servers
upstream app_servers {
server 127.0.0.1:8080;
}
# Configuration for the server
server {
# Running port
listen 80;
# Proxying the connections connections
location / {
proxy_pass http://app_servers;
proxy_redirect off;
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-Host $server_name;
}
}
}
We set up NGINX in order to get LetsEncrypt certificates up and working for our site. Our NGINX configuration is very simple, and proxies all traffic directly to the Rails app, even for static content.
To speed up our static content, we should mount the
public
directory into the NGINX container and serve it directly.