Skip to content

Instantly share code, notes, and snippets.

@julienbourdeau
Last active July 5, 2019 21:46
Show Gist options
  • Save julienbourdeau/09a2454560d01a01b68ed052fa10f549 to your computer and use it in GitHub Desktop.
Save julienbourdeau/09a2454560d01a01b68ed052fa10f549 to your computer and use it in GitHub Desktop.
Nginx config for Rails app (used with Laravel Valet)
# /usr/local/etc/nginx/servers/algolia.test
upstream myapp {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name algolia.test admin.algolia.test;
access_log /var/log/nginx/algolia.test/access.log;
error_log /var/log/nginx/algolia.test/error.log;
root /var/www/myapp.example.com;
index index.html;
location / {
try_files $uri/index.html $uri.html $uri @app;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {
try_files $uri @app;
}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://myapp;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment