LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-16-2012, 03:14 AM   #1
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Rep: Reputation: 0
Red face Apache2 - disable default virtual hosts problem


Hi,

I have created 3 virtual hosts e.g. /etc/apache2/sites-available/mynewsite and used a2ensite and restarted apache. I can browse to the site no problem.

I want to disable the default site /etc/apache2/sites-available/default but when I issue a2dissite default and restart apache none of the virtual hosts can be accessed either?

How do I do this?

cheers


Mark
 
Old 08-16-2012, 06:04 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Hi,

I guess there is a
Code:
NameVirtualHost *
in /etc/apache2/sites-available/default, that there not exists in your vhosts files, that's why vhosts are not working
If you're sure you want to disable the default vhos, move the above directive into apache2.conf

Regards
 
Old 08-16-2012, 08:29 AM   #3
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Hi,

I guess there is a
Code:
NameVirtualHost *
in /etc/apache2/sites-available/default, that there not exists in your vhosts files, that's why vhosts are not working
If you're sure you want to disable the default vhos, move the above directive into apache2.conf

Regards
This is my "/etc/apache2/sites-available/default" file contents

Code:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

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

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

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
No sign of a
Code:
NameVirtualHost *
?
 
Old 08-16-2012, 10:06 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Since you're using a <VirtualHost *:80> notation, there should be a directive like:
Code:
NameVirtualHost *:80
By default it's in the default vhost file. Maybe you have moved it in some other config file. So search /etc/apache2/
Anyway, what it the error you get whne trying to access your other vhosts?
 
Old 08-17-2012, 06:28 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
I don't think you need to add 'namevirtualhost'; it's more than likely already set in one of the config files.

You can navigate to /etc/apache2 and run
Code:
grep -iR namevirtualhost *
to find it. You might find it in http.conf (not sure).
 
Old 08-17-2012, 09:27 AM   #6
mcc28
LQ Newbie
 
Registered: May 2006
Posts: 13

Original Poster
Rep: Reputation: 0
The output of
Code:
grep -iR namevirtualhost *
is

Code:
ports.conf:NameVirtualHost *:80
ports.conf:    # If you add NameVirtualHost *:443 here, you will also have to change
I might just leave it for now and come back later as someone has suggested it would be good practice to leave the default as a catchall?
 
  


Reply

Tags
apache2


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
apache2 virtual hosts dave`2005 Ubuntu 1 11-19-2007 07:17 AM
Virtual hosts on apache2 70mas Linux - Server 3 07-16-2007 02:29 AM
Apache2 Name-based Virtual Hosts Problem with .org domain! phoenix09 Linux - Software 18 09-19-2006 04:23 AM
Apache2 - need help with virtual hosts bioalchemist Linux - Software 5 08-11-2006 01:24 PM
apache2 virtual hosts viniosity Linux - Software 4 02-07-2004 12:15 AM


All times are GMT -5. The time now is 07:56 AM.

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