Revisions
-
joemccann revised this gist
Oct 25, 2010 . 1 changed file with 15 additions and 22 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,23 @@ The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu). In a nutshell, 1) nginx is used to serve static files (css, js, images, etc.) 2) node serves all the "dynamic" stuff. So for example, www.foo.com request comes and your css, js, and images get served thru nginx while 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 (for this example only. you can change this port for your node app). So in your <code>/etc/nginx/sites-available/default</code> modify your <code>location /</code> stanza and add the second stanza of this code block: <code> 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 to name an index file: #index index.php index.html; access_log off; } @@ -28,21 +26,16 @@ So in your /etc/nginx/sites-available/default: root /var/www/yoursitename/public; } Note: I did not change the <code>/etc/nginx/nginx.conf<code> file. It is still the default <code>nginx.conf</code> from the nginx installation. Now, restart nginx. <code>/etc/init.d/nginx restart</code> (Re)start your node app. <code>node /path/to/your/node/app.js</code> Navigate to your site and verify. Enjoy blazing fast static files and blazing fast dynamic content. -
joemccann renamed this gist
Oct 25, 2010 . 1 changed file with 16 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ The idea is to have nginx installed and node installed. Will extend this gist to include how to install those as well, but at the moment, 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. @@ -13,12 +13,13 @@ everything else (the request for say index.html or "/") gets served through node 4) node listens on port 8124. So in your /etc/nginx/sites-available/default: <code> [...] 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 to name an index file, otherwise a 403 will return: #index index.php index.html; access_log off; } @@ -33,3 +34,15 @@ So in your /etc/nginx/sites-available/default: allow 127.0.0.1; deny all; } </code> [...] Restart nginx. <code>/etc/init.d/nginx restart</code> Restart your node app. <code>node /path/to/your/node/app.js</code> Navigate to your site and verify. -
joemccann revised this gist
Oct 25, 2010 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ 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. -
joemccann created this gist
Oct 25, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ 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; }