Nginx configuration to work with Node.js -


i know there similar questions or walkthroughs here or in web although stuck on this.

the background

i trying set local virtual host ghost.local there ghost blog(which on node.js). want, when visit http://ghost.local on ubuntu 14.04 machine nginx pass request node.js , 'll able see ghost blog.

the problem

i 've set hosts file 've set nginx vhosts ghost running on node.js. although when visit http://ghost.local

503 service unavailable failed resolve name of server ghost.local

my hosts file:

 127.0.0.1  ghost.local  127.0.0.1  localhost 

my /etc/nginx/sites-available/ghost.local file:

 server {      listen 80;      server_name ghost.local;      access_log /var/log/nginx/ghost.local.log;       location / {                  proxy_set_header x-real-ip $remote_addr;          proxy_set_header x-forwarded-for $remote_addr;          proxy_set_header host $http_host;            proxy_pass http://localhost:2368;          proxy_redirect off;     }  } 

the link in /etc/nginx/sites-enabled/ghost.local set right.

i didn't post ghost or node.js because on http://localhost:2368 , running fine.

any idea anyone? thank in advance.

edit mentioned in comment problem on machine set above configuration worked in new machine.

first off seems installed wrong version of nginx. did install yourself, if should reinstall nginx latest version.

secondly, confused if website on http://ghost.local?

because server_name supposed sub/domain website, example:

server_name www.example.com example.com test.example.com; 

here basic nginx configuration website @ http://example.com

server {         listen 80;         server_name example.com;         location / {                 proxy_set_header x-real-ip $remote_addr;                 proxy_set_header host      $http_host;                 proxy_pass                 http://127.0.0.1:2368;         } }  server {         listen 80;         server_name www.example.com;         return 301 http://example.com/$request_uri; } 

make sure restart nginx afterwords.

service nginx restart 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -