Kelly Wagner's picture

Discovered the Wordpress Turnkey Appliance and love it!  Was setting up some IP based virtual servers, and no matter what, when using the FQDN it automaticaly directs the clients to the /var/www/wordpress directory.  


Is there something baked in the image that would cause this?

Forum: 
Jeremy Davis's picture

Thanks for your kind words and I'm really glad to hear that you are finding our WordPress appliance useful, albeit with a little bit of pain for your desired setup...!

TBH, I'm unfamiliar with WordPress multi-site hosting, but I see no reason why it shouldn't work.

My guess is that it's the default Apache config. As you can see the default config explicitly points all incoming traffic to /var/www/wordpress.

If you want to use Apache to direct incoming traffic to different places, then I suggest that you remove the 'ServerName' directive from the top of that file (/etc/apache2/sites-available/wordpress.conf), then within the 'VirtualHost' section add a new 'ServerName' entry there, with the domain you want to server the existing WordPress from. You'll want to do that for both port 80 and 443 (http & https). So assuming a domain of "www.example.com", your resulting wordpress.conf would look like this:

<VirtualHost *:80>
    UseCanonicalName Off
    ServerAdmin  webmaster@localhost
    ServerName www.example.com
    DocumentRoot /var/www/wordpress
</VirtualHost>

<VirtualHost *:443>
    SSLEngine on
    ServerAdmin  webmaster@localhost
    ServerName www.example.com
    DocumentRoot /var/www/wordpress
</VirtualHost>

<Directory /var/www/wordpress>
    Options +FollowSymLinks
    Options -Indexes
    AllowOverride All
    order allow,deny
    allow from all
</Directory>
To add an additional site (let's say www.example.net) which points to a doc root of /var/www/new-site, I'd just copy the existing virtualhost and edit it accordingly. I.e.:
cp /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-available/new-site.conf
Then edit that and swap all instances of '/var/www/wordpress' to '/var/www/new-site' and instances of 'www.example.com' to 'www.example.net'. Here's how I'd do it (manually doing it is fine, I'm just showing off my ninja commandline skills! :)
sed -i "s|/var/www/wordpress|/var/www/ne-site|" /etc/apache2/sites-available/new-site.conf
sed -i "s|www.example.com|www.example.net|" /etc/apache2/sites-available/new-site.conf
Obviously in your context, you'd want to adjust the things to substitute, i.e. paths and domain name.

Then you just need to restart Apache:

service apache2 restart
And you should be good to go! :)
Kelly Wagner's picture

Bada-Bing!  Thank you, it works.  

Jeremy Davis's picture

Great news! :)

Add new comment