Trevor Sauerbrey's picture

We have a Apache/Wordpress DB Turnkey Server wite a site surrently set up on it with no domain attached to it so all port 80 traffic goes to that Wordpress install. I would like to set up another site that uses a totally different domain name on that same server. I can set up the wordpress databases/directories no problem. How do I go about getting Domain A to point to one directory and Domain B to point to another both on port 80.

For explanation purposes:

Domain A - abcxyz.com

Domain B - 12345.com

Thank you for any an all help!

Trevor

Forum: 
Jeremy Davis's picture

Is this the TurnKey WordPress appliance?

If so, I would just copy the existing Apache WordPress conf to a new conf file. E.g.:

cp /etc/apache2/sites-avaialble/wordpress.conf /etc/apache2/sites-available/new-site.conf
Then adjust the VirtualHost directives (currently using wildcard instead of domain name) in each file to be the domain which you want each to serve. You'll also probably want to adjust the "ServerName" too (by default it's set to localhost).

If you want to use HTTPS for your sites then you'll also need to add the SSL cert locations ("SSLCertificateFile" directive) to each of the site conf files within the relevant section (i.e. port 443). You'll need a separate cert for each domain.

Then to tidy up, enable your new site and restart Apache:

a2ensite new-site
service apache2 restart

For further info please consult the Apache named besed virtualhost config docs. Keep in mind though that the config file locations are different in TurnKey comparted to Apache defaults.

Jeremy Davis's picture

I've just done a bit more reading and I was leading you astray. Apologies on that. It's been a while since I've played with Apache much and was working from memory.

From my reading of the Apache docs what you have should work. Note that the docs refer to httpd.conf, but as I hinted earlier Debian (and derivatives such as TurnKey) do things differently and have individual conf files, rather than one big monolithic httpd.conf.

What I was (mistakenly) suggesting was to swap the wildcard (*) in the VirtualHost directive (i.e. the "<VirtualHost *.80>") for the server name. That is incorrect as you replace the wildcard for an IP (if you are using IP based virtual hosts). So bottom line is I think that should work... Does it?

FWIW there are some example Apache conf here.

Add new comment