Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 10-10-2012, 11:19 AM   #1
LQ Newbie
Registered: Nov 2010
Posts: 20

Rep: Reputation: 4
Having trouble setting up Apache virtual hosts on Ubuntu 12.04

Hello everyone! I'm having some trouble configuring apache to properly serve my two websites which I have on a personal server. I'm running Ubuntu 12.04.1 x64 Server Edition.

I have two sites in /var/www/ which I'll refer to as and It all started out with me being able to view both site1 and site2 perfectly but when attempting to access my phpmyadmin installation through http://localhost/phpmyadmin I got permission denied errors.

I'm not entirely sure that my configuration is correct since I haven't configured this before, I've just dived into all the documentation I've been able to find. This is how it looks like today.

----web -> /usr/share/wordpress
----web -> /usr/share/wordpress
with the permissions for each directory:
drwxrwxr-x 3 root www-data uploads
lrwxrwxrwx 1 root www-data web
I have set up a global configuration in httpd.conf (correct me if this is wrong) with basically the settings that were in the default-site bundled with lampp:
ServerSignature Off
ServerTokens Prod

NameVirtualHost *:80

<ifmodule mod_ssl.c>
	NameVirtualHost *:443

<Directory />
	Options -Indexes FollowSymLinks
	AllowOverride None
	Order deny,allow
	Deny from all

<Directory /var/www/>
	Options -Indexes FollowSymLinks MultiViews
	AllowOverride None
	Order allow,deny
	Allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bin/>
	AllowOverride None
	Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
	Order allow,deny
	Allow from all

Alias /doc/ /usr/share/doc/
<Directory /usr/share/doc/>
	Options -Indexes MultiViews FollowSymLinks
	AllowOverride None
	Order deny,allow
	Deny from all
	Allow from ::1/128 	
The NameVirtualHost setting gives me an error on startup of apache but I don't know if it matters:
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
[Wed Oct 10 16:52:28] [warn] NameVirtualHost *:80 has no Virtualhosts
and the site specific configuration (the same for both sites except for the FQDN):
<VirtualHost *:80>

	LogLevel warn
	ErrorLog /var/log/apache2/
	CustomLog /var/log/apache2/ combined

	DocumentRoot /var/www/
(Do the <Directory> options, like -Indexes, need to be specified here as well?)

My /etc/hosts configuration looks like this:
Code:	localhost	servername


# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
All help is welcome, I look forward to learning how I can secure the server better!
Old 10-10-2012, 12:40 PM   #2
LQ Newbie
Registered: Nov 2010
Posts: 20

Original Poster
Rep: Reputation: 4
Nevermind, I got it working! I removed all the configuration done in httpd.conf and just set the standard parameters in /etc/apache2/conf.d/security which seemed to be best practice. Then I added the <Directory> configurations from /etc/apache2/sites-available/default to each site's configuration but changed <Directory /var/www/> to <Directory /var/www/> which I hadn't done before and now both my sites + phpmyadmin works! Huzzah!


apache, configuration, server, ubuntu 12.04, virtual host

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Setting up Apache 2.2 virtual hosts WetDreams Slackware 3 12-11-2011 06:40 AM
[SOLVED] Apache Virtual Hosts - Ubuntu Desktop Macnux Linux - Server 7 07-15-2011 07:26 PM
LXer: Setting Up Subversion And Trac As Virtual Hosts On An Ubuntu Server LXer Syndicated Linux News 0 01-13-2008 10:20 AM
About setting up virtual hosts raymond Linux - General 7 09-21-2004 10:14 AM
Setting up virtual hosts in Apache using Webmin Spudley Linux - Software 2 09-25-2003 09:50 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration