Ghost and Wordpress on different subdomains on a single Droplet

Posted May 4, 2016 4.6k views

I have a domain and I want wordpress to run at and ghost to run at I have installed both wordpress and ghost (on 2368 as suggested in default).
I have a zone file of

$TTL 1800 IN SOA 1462332598 10800 3600 604800 1800 1800 IN NS 1800 IN NS 1800 IN NS 1800 IN A 1800 IN AAAA 2400:6180:0:d0::552:1 1800 IN CNAME 1800 IN CNAME```

and the NGINX config file server blocks as:

server {
        listen 80;
        root /var/www/wordpress;
        index index.php index.html index.htm;


        location /  {
                try_files $uri $uri/ /index.php?q=$uri&$args;

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /usr/share/nginx/html;

        location ~ \.php$ {
                try_files $uri $uri/ =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host      $http_host;

Now the problem being both and both resolve to the ghost installation.
Why is this happening and how can I rectify it?


1 comment
  • I have also observed that wordpress resources are being requested on, therefore on client side there are 404’s for all resources requested on this path. How can I rectify this?

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.

Submit an Answer
3 answers

It looks like that “” entry is wrapping back to itself.

But try this:

  1. Delete the CNAME entry.
  2. Add an A record named “wordpress” and pointing at the IP address of your droplet (
  3. Change the server_name directives in your Nginx configuration, take out the “http://”:



What’s happening is that Nginx can’t find a configuration for, so it defaults to and up pops Ghost. The “default_server” on the “listen” directive means exactly that - “use this one if you can’t find the one requested”.

  • Thanks mate, it worked like a charm.
    But why did you suggest removing the CNAME entry? I didn’t understand.

    • Generally, CNAME records are used to map one name to another one, which is not what you want here - is not the same site as You’d use a CNAME record (named “www”) to make your site accessible at both and, because and are one and the same site. Think of a CNAME record as an alias for another record.

      A records on the other hand, are used to directly map domain names to IP addresses. A DNS lookup on with an A record would go: -> IP address

      With a CNAME record: -> -> IP address

      In this case, either one actually would work, it’s just a tiny bit more efficient to use an A record. But the name used in CNAME records has to be unique - and so (for example) you’d run into problems if you ever needed to add an MX record which would have the same name.

To answer your WordPress question: if this is a new installation and losing everything isn’t a problem, the easiest answer is just to start over and reinstall it on the subdomain. Otherwise it gets… tricky.

Moving Directories On Your Existing Server

Why do you want them on the same droplet? They are totally different server configurations. WordPress runs on PHP + Apache and Ghost on node.js + Nginx. Granted, you can do this, but why?

  • Wordpress mandates PHP not apache. I personally find NGINX more configurable and much easier to use. Its more of a personal choice really. What I am doing is not unconventional and neither is it unheard of. People having microservices architecture do run two different technology stacks on a the same instance, it saves resources.

    • Not sure how it saves resoruces when you can have 2 512 MB RAM single core servers for $10 or 1 1 GB RAM server for $10. In terms of disk space and cores you would get more resources for the same price with two instances on digital ocean.

      WordPress may “mandate” only PHP but it certainly wasn’t intended to run on Nginx out of the box.