Last active
July 5, 2019 21:46
-
-
Save julienbourdeau/09a2454560d01a01b68ed052fa10f549 to your computer and use it in GitHub Desktop.
Nginx config for Rails app (used with Laravel Valet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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