VHost from hell…


Well I thought this would be a funny story to share to showcase my relative incompetence… Hey, I am a guy who can take BEING the joke… So I am playing around with my fav blog app, WordPress, and I have well a bunch of sites locally that I work on… All beta/test sites, all internal so basically just for me and my co-workers if they like.  I thought it may be cool to host all of my WordPress sites on 1 physical device instead of on 5 like I have now… So I began my journey into  accomplishing this. F! I just spilled Loganberry on my shirt… (it stains quite badly)… OK… so for the last hour I have been trying to get this to work and in one way or another it just doesn’t.  First, as I am on a Windows domain, I thought I would add the CNAME’s to the DNS host.. ya know to make life easier… So I did that… and everything was working as expected… Next it was time to create the WordPress installations for each individual site.  No biggie there either, except for the mysql aspect where I was not able to make it work with any other user other than root.  Which for me is not a problem in this environment, but it certainly is not the right way to do it.  I guess I don’t know what group I need to create or add the new user to to make the mysql database work properly or at all with the mysql user I created for the new databases.  So I just gave up on that for the time being.

Examples of what I tried:

NameVirtualHost *:80

<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/wordpress
ServerName wordpress.proserve.local
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

NameVirtualHost 192.168.11.39:80

<VirtualHost 192.168.11.39:80>
#    ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/wordpress
ServerName wordpress.proserve.local
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

NameVirtualHost 192.168.11.39:80

<VirtualHost 192.168.11.39:80>
#    ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/wordpress
ServerName wordpress.proserve.local
ServerAlias wordpress
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

root@centOS54 wordpress]# host wordpress
wordpress.proserve.local is an alias for centos54-a.proserve.local.
centos54-a.proserve.local has address 192.168.11.39

[root@centOS54 wordpress]# pwd
/var/www/html/wordpress/wordpress

And none of this worked properly.  It renders a site, but none of the WordPress theme components are visible.   If I comment out all of the VHost crap and just use the complete path in the URL, like this http://centOS54-a/wordpress/wordpress … everything is fine for this and all of the other sites I have created.  So I must be missing something simple on this, which is very annoying to say the least. Well enough of this for now… I will add as I achieve more success or someone that sees my foolishness makes a comment to help me out !!

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/html/wordpress/
ServerName wordpress.proserve.local
ServerAlias wordpress
ErrorLog /var/log/wordpress_error.log
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/blahville/wordpress/
ServerName blahville.proserve.local
ServerAlias blahville
ErrorLog /var/log/blahville_error.log
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/annlee/wordpress/
ServerName annlee.proserve.local
ServerAlias annlee
ErrorLog /var/log/annlee_error.log
</VirtualHost>

Advertisements

, , , , , , , , , ,

  1. #1 by gmconklin on April 19, 2010 - 9:51 am

    hmmm… I recently came across the use of virtualmin for this entire process… as it’s virtual host creation GUI is pretty awesome, I have yet to tie it into the actual wordpress setup, but for the DB it is awesome.

  2. #2 by gmconklin on March 12, 2010 - 7:58 pm

    OMG… Well it was worse than I thought… I, of course, was my own worst enemy here. I have so many machines setup I had just forgotten that I had conflicting names for sites, and they were down so when I was trying to use the same name the look up was going to a server that was down, not the vhost I was expecting… LOL. And when I did that, I was able to see my syntax error in the DocumentRoot directive in the VHost listings. The final “/” was required otherwise I went only to the default Apache index.html file. All that being said, here is the correct httpd.conf file that I have working now (I am only showing the basic changes I made, not the whole file):

    Listen 192.168.11.39:80
    ServerName 192.168.11.39:80
    UseCanonicalName Off
    DocumentRoot “/var/www/html”
    NameVirtualHost *:80

    DocumentRoot /var/www/html/wordpress/
    ServerName wordpress.proserve.local
    ServerAlias wordpress
    ErrorLog /var/log/wordpress_error.log

    DocumentRoot /var/www/html/blahville/wordpress/
    ServerName blahville.proserve.local
    ServerAlias blahville
    ErrorLog /var/log/blahville_error.log

    DocumentRoot /var/www/html/annlee/wordpress/
    ServerName annlee.proserve.local
    ServerAlias annlee
    ErrorLog /var/log/annlee_error.log

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: