Skip to content

Instantly share code, notes, and snippets.

@bolshakov
Created August 21, 2019 09:00
Show Gist options
  • Save bolshakov/853d56cbbdf88443ef6df662349a737e to your computer and use it in GitHub Desktop.
Save bolshakov/853d56cbbdf88443ef6df662349a737e to your computer and use it in GitHub Desktop.
# /etc/nginx/nginx.conf
http {
access_log /dev/stdout;
include /etc/nginx/mime.types;
default_type application/octet-stream;
proxy_cache_path /tmp levels=1:2 keys_zone=thumbs:10m inactive=24h max_size=1G;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_redirect off;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_buffers 32 4k;
proxy_buffer_size 8k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_headers_hash_bucket_size 64;
include /etc/nginx/conf.d/*.conf;
}
# /etc/nginx/conf.d/rails_app.conf;
upstream rails_app {
server 127.0.0.1:3003;
}
server {
listen 8083;
location ~ ^/(assets)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
proxy_pass http://rails_app/assets;
break;
}
location / {
proxy_pass http://rails_app;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment