-
-
Save lotsofcode/6249537 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
The idea is to have nginx installed and node installed. Will extend this gist to include those soon, but the following assumes you have nginx and node installed on a linux distro (I used Ubuntu | |
1) nginx is used to serve static files (css, js, images, etc.) | |
2) nginx.conf - changes required to allow proxying back thru to your node app. | |
So, www.foo.com request comes in | |
css, js, and images get served thru nginx | |
everything else (the request for say index.html or "/") gets served through node. | |
3) nginx listens on port 80. | |
4) node listens on port 8124. | |
So in your /etc/nginx/sites-available/default: | |
location / { | |
proxy_pass http://127.0.0.1:8124; #this is the ip:port where your node app runs | |
root /var/www/yoursitename; | |
expires 30d; | |
#uncomment this is you want php to pass thru: | |
#index index.php index.html; | |
access_log off; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ { | |
root /var/www/yoursitename/public; | |
} | |
location /doc { | |
root /usr/share; | |
autoindex on; | |
allow 127.0.0.1; | |
deny all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment