Report this

What is the reason for this report?

Vestacp Nginx proxy passing to a node application

Posted on March 16, 2015

Hello DO Community, I hope all of you are doing great.

I am facing an issue with nginx proxy passing. So far I have successfully install Ubuntu 14.04 and vestacp panel and they are working great. I can even create sub-domains with no problem.

Now I want to create a ghost blog in a sub-domain (eg blog.main-doimain.com) which by the way runs on node. I have managed to run the ghost blog on port 3000 and i can access it using main-domain.com:3000

To access it via sub-domain I have added following server block on nginx (which is installed by vestacp)

server {
    listen 80;
    server_name blog.main-domain.com;

    root /var/www/ghost;
    index index.html index.htm;

    location / {
        proxy_pass http://127.0.0.1:3000;
    }
}

but still i can’t access it.

Then I created a blank droplet, installed ubuntu 14.04, installed nginx (only) then installed ghost in it in the same way and added the above server block. And surprisingly it worked, I could access it like blog.main-domain.com!!!

My question is:

  1. Am I doing something wrong??
  2. Does vestacp & ghost work along side this way or not??
  3. Has anyone tried something like this and succeeded or failed??

Thank you and sorry for really long post.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

When i do that my mail service stop working, what should i do??

ip i try to redirect x.x.x.x:8069, i want to show like x.x.x.x

when i try to loging to my x.x.x.x/webmail i get 404

I was able to solve my problem. I had to make following changes to do so:

in the server block:

    server {
        # previously
        # listen 80; 

        # now
        # here a.b.c.d is my droplet ip
        listen a.b.c.d:80;  

        server_name blog.main-domain.com;

        root /var/www/ghost;
        index index.html index.htm;

        location / {
            # previously
            # proxy_pass http://127.0.0.1:3000;

            # now
            # here a.b.c.d is my droplet ip
            proxy_pass http://a.b.c.d:3000;
        }
    }

and in the ghost blog config file:

    server: {
        host: 'a.b.c.d', /* here a.b.c.d is my droplet ip */
        port: '3000'
    }

and lastly i had to change iptable to accept request on port 3000. that it!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.