I have a domain and I want wordpress to run at wordpress.domain.com and ghost to run at domain.com. I have installed both wordpress and ghost (on 2368 as suggested in default). I have a zone file of
$ORIGIN domain.com.
$TTL 1800
domain.com. IN SOA ns1.digitalocean.com. hostmaster.domain.com. 1462332598 10800 3600 604800 1800
domain.com. 1800 IN NS ns1.digitalocean.com.
domain.com. 1800 IN NS ns2.digitalocean.com.
domain.com. 1800 IN NS ns3.digitalocean.com.
domain.com. 1800 IN A 188.166.244.167
domain.com. 1800 IN AAAA 2400:6180:0:d0::552:1
www.domain.com. 1800 IN CNAME domain.com.
wordpress.domain.com. 1800 IN CNAME wordpress.domain.com.```
and the NGINX config file server blocks as:
server {
listen 80;
root /var/www/wordpress;
index index.php index.html index.htm;
server_name http://wordpress.domain.com;
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;
server_name http://domain.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}
Now the problem being both wordpress.domain.com and domain.com both resolve to the ghost installation. Why is this happening and how can I rectify it?
Thanks
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!
It looks like that “wordpress.domain.com” entry is wrapping back to itself.
But try this:
server_name wordpress.domain.com;
and:
server_name domain.com;
What’s happening is that Nginx can’t find a configuration for wordpress.domain.com, so it defaults to domain.com 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”.
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.
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?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.