This is where you have actually put all app:
$> ls -l /var/sites/app
here _local_ is missing.
this pont tho nginx doesn't know about your apps existence.
if you want to put your node app behind nginx you may experiment with
something like this:
..
location / {
proxy_pass localhost:8080
}
..
more info at the proxying examples
http://wiki.nginx.org/NginxConfiguration
f
> --
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en.
>
Node.js is only good as people can deploy it and so we would like to add to the documentation. At the moment we cannot get node apps to render on an ubuntu production server with nginx - it seems nginx permissions are tricky. Maybe someone can help? here is our setup:
Ubuntu Lucid
/usr/bin/nginx => nginx installed with sugo apt-get install nginx
/etc/nginx/sites-enabled/app (actually in sites-available and sym linked)
server {
listen 80;
server_name www.myapp.com;
rewrite ^/(.*) http://myapp.com/$1 permanent;
}
server {
listen 80;
server_name myapp.com;
access_log /var/local/sites/app/log/access.log;
error_log /var/local/sites/app/log/error.log;
location / {
root /var/local/sites/app/;
index index.html;
}
}
On 05/31/2010 12:27 AM, Floby wrote:
> Yep, Proxy pass is the solution, worked fine for me. I followed some
> if the instructions of this tutorial for Ruby& nginx but it's really
server {
listen 80;
server_name www.howtonode.org;
rewrite ^/(.*) http://howtonode.org permanent;
}
upstream backend {
server unix:/tmp/howtonode.sock;
}
server {
listen 80;
server_name howtonode.org;
location / {
server_tokens off;
add_header Server "Wheat (node.JS)";
proxy_pass http://backend;
}
}
If you're running the node app on a regular tcp port then you don't even need the separate upstream section, that's only required for unix sockets.
If you game me more specifics like what code you're using and exactly what http request your browser is making I can help more.
From you original post it looks like you're hitting localhost with curl, but the www.myapp.com in the browser. Try the domain name from curl too. When using virtual hosts, the Host header matters a lot to nginx.
thks Tim for the sample config.
If I run curl with the domain I get html with "301 Moved Permanently"
I don't understand where the add_header label comes from - our config is
below with the exception that we changed location / to using proxy_pass
tried to follow this and server is crashing - did you have changes to
this ?
also nginx config is set up to have a user "www-data", our node
scripts are set up to have user "node" - are there conflicts here ?
(we don't even have a user for www-data - maybe need to add one).
I really thing most of the problems track back to nginx and user
permissions - we had lots of trouble with permissions with sinatra and
eventually went back to apache with no problems. but I understand why
nginx is better for node - just need to get all these permission issues
resolved.