Apache2 - VirtualHosts - phpMyAdmin question

Hi Guys,

I’ve been thinking recently about getting myself some VPS space to host a WordPress blog for myself (keep all my notes from work over the last 15 years!) and maybe consider playing around with some OwnCloud whilst I’m at it :slight_smile:

Before i take the plunge and sign up to anything, I’ve fired up a minimal openSUSE 13.1 server on VirtualBox locally to test my build and configuration and I’ve run into a challenge. Now i’m not a network / server admin by trade and this has been my very simply approach (which may be wrong and i’m open to advice all the way).

I’ve installed my LAMP, with apache2, mySQL (MariaDB) and php5 all with the phpMyAdmin utilities for managing database etc.

I have configured a static IP address and pointed that to a host called opensuse.gsustech.com, so when i open h**p://opensuse.gsustech.com everything works fine and i see the phpMyAdmin page and i can manage my databases accordingly.

However, when i start to introduce VirtualHosts to apache2, things start to get messed up.

At this point i’ve not altered any config files, so everything works straight out of the box as intended.

I have one local user called ‘webadmin’ and 2 directories in /home, one for wordpress and the other for owncloud :


/home/webadmin/wordpress
/home/webadmin/owncloud

I’ve added additional entries to my hosts file so that the server names can be resolved :


/etc/hosts

192.168.56.101   wordpress.gsustech.com
192.168.56.101   owncloud.gsustech.com

I’ve created a wordpress.conf and owncloud.conf in the vhosts.d directory under :


/etc/apache2/vhosts.d

In each of these virtual host directories in my user home I’ve created an index.html for testing.

When i restart the apache2 service and navigate to the urls for hp://wordpress.gsustech.com and hp://owncloud.gsustech.com i see my index files and i’m pointing to the right pages, however if i point back to h**p://opensuse.gsustech.com the phpMyAdmin can no longer be displayed.

I hope this all makes sense, and i really just wanted opensuse.gsustech.com to be my default server, and have wordpress.gsustech.com and owncloud.gsustech.com as my virtual servers.

If i remove my wordpress.conf and owncloud.conf from the /etc/apache2/vhosts.d directory i can open the phpMyAdmin on opensuse.gsustech.com again.

Hope this all makes sense.

Thanks

Glen

Hopes this all makes sense

How did you create those files? AFAIK YaST doesn’t correctly work with the current apache version.
Maybe you should post those files here, so somebody could tell you what mistake(s) they contain.

Thanks wolfi323,

I created the virtual host config files manually using the vhost.template as a starting point…however i think i might have resolved my problem.

I guess the term ‘default’ server doesn’t actually make sense if i’m using virtual hosts, i resolved this by making an additional virtual host config file for the url opensuse.gsustech.com.

So now i have the following

virtual hosts file ‘opensuse.conf’ pointing to ServerName ‘opensuse.gsustech.com’ and DocumentRoot ‘/srv/www/htdocs’ where my phpMyAdmin lives.

virtual hosts file ‘wordpress.conf’ pointing to ServerName ‘wordpress.gsustech.com’ and DocumentRoot ‘/home/webadmin/wordpress’ where my WordPress lives.

virtual host file ‘owncloud.conf’ pointing to ServerName ‘owncloud.gsustech.com’ and DocumentRoot ‘/home/webadmin/owncloud’ where my OwnCloud lives.

Next on the list is to enable SSL now and then study up to find out how i might make the whole thing completely secure :slight_smile:

Thanks again

Glen

vhost config files override the “default” configuration for the specific vhost obviously.
Things not configured in the vhost file will be taken from the ‘default’ server though I think.

Next on the list is to enable SSL now and then study up to find out how i might make the whole thing completely secure :slight_smile:

Have a look at /etc/sysconfig/apache2, in particular add “SSL” to the APACHE_SERVER_FLAGS, either by editing that file directly or running:

a2enflag SSL

I have no experience with setting that up though, but I think you need to also create a certificate.
This should help you, although I have no idea if that still applies fully with 2.4: (it’s from 2009)
http://old-en.opensuse.org/Apache_Howto_SSL