TLUG,
Recently I needed to set up a virtual named host on my laptop. It's a
clean install of Ubuntu Karmic 9.10.
I've set up LAMP servers on Ubuntu many times now, so I've got it down
to a science.
Or so I thought.
When it comes to naming virtual hosts, what I used to do was simply open
up /etc/apache2/httpd.conf and edit it.
This time, though, when I opened /etc/apache2/httpd.conf, it was
suspiciously empty. I tried adding my usual configurations, but when I
restarted Apache, my site was nowhere to be found.
So I looked on line, and now it seems everything is handled in a
directory called /etc/apache2/sites-available and basically all the
configurations are now done in a different way.
F**k.
I made an effort to figure out how to do this, and went through many
variants of new settings that did not work.
Here's my current situation. I created a file for my site, called
local_site.com in /etc/apache2/sites-available and put in the following
configuration (taken off the web)
- - - - -
<VirtualHost *>
ServerName www.local_site.com
ServerAlias local_site.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/local_site.com
<Directory /var/www/local_site.com/>
Options Indexes FollowSymLinks MultiViews
# pcw AllowOverride None
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2's default
start page
# in /apache2-default/, but still have / go to the right
place
# Commented out for Ubuntu
#RedirectMatch ^/$ /apache2-default/
</Directory>
ErrorLog /var/log/apache2/local_site.com/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/local_site.com/access.log combined
ServerSignature On
</VirtualHost>
- - - - -
Then I ran "sudo a2ensite local_site.com", and it said "enabled".
So far so good.
Then I reloaded and restarted Apache, and it said:
[fail]
No error output, no nothing. Just [fail].
I went to http://local_site.com and sometimes when I do, I get the
default "It works!" page. Which I also get if I go to http://localhost.
But sometimes if I reload it, I then get an "unable to connect" warning.
I went online and found instructions for editing ports.conf and
apache2.conf, but basically any and all edits I made to those files
resulted in errors coming out when I restarted Apache. So for now I've
put them back to their original.
And, lastly, I checked the error logs in /var/log/apache2, but they just
have a long string of instances of saying "error log at
/var/www/local_site.com/error.log not found".
I'm going to skip past the bitching about having to learn new crap to
accomplish the same tasks...
What am I supposed to do to get my virtual host working?
Thanks for any advice.