Question

Subdomains on Ubuntu LTS 12.04 with ngnix and ghost

  • Posted June 17, 2014

So I had my droplet setup to point directly to a ghost installation I made during the configuration of the droplet. My DNS record is like this:

A @ my.ip.address CNAME * @

And the DNS records for DO

so if I went to mydomain.com my ghost blog would load.

Now I wanna make some changes, I would like to have a subdomain for example: blog.mydomain.com that points to my ghost blog and leave a static html(or another type of content) to mydomain.com

I’m trying to follow this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3

But it didn’t work, and I beleive it’s because I didn’t setup the DNS records properly and perhaps didn’t setup the permissions properly.

How can I setup a subdomain and keep my current ghost install?

Thanks for the time!

Subscribe
Share

Submit an 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.

Thanks for the info astarr

It finally worked, I had to tinker with nginx a bit since I hadn’t used it before, your config helped me, so for anyone looking to something like this here is my config file for nginx:

http://pastebin.com/PPNQzfCX

And just be wary of a couple of things: -Remember to run ghost again, I stopped the service and forgot to start it again. -Restart nginx to apply any config changes

Thanks for the help

Your DNS settings look fine. Now it’s a matter of getting your Nginx configuration right. You need to use the <code>server_name</code> directive. So your conf might look something like: <pre> server { listen 80; server_name blog.example.com ;

client_max_body_size 10M;

location / {
        proxy_pass http://localhost:2368/;
        proxy_set_header Host $host;
        proxy_buffering off;
}

} server { listen 80; server_name example.com;

    root /var/www/example.com/public_html;
    index index.html index.htm;

} </pre> Let us know how it goes!