Search code examples
apache2virtualhostlampubuntu-13.10

Resolve Error default site does not exist after update to Ubuntu 13.10 and apache 2.4


I updated my ubuntu lately, I wanted to program in my Ubuntu 13.10, and was setting up apache2, and every time I run the command:

sudo a2ensite default

I get the following error:

Error default site does not exist

how can I fix this issue?


Solution

  • To fix this and any other virtual host running on apache 2.4 I needed to set the

    default (and any other virtual host you have)

    as

    default.conf (add .conf any virtual host you have already set)

    Enter the console (terminal) and type the following commands:

    sudo mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.conf
    sudo a2ensite default

    And we will get the following:

    Enabling site default. To activate the new configuration, I needed to run: service apache2 reload
    

    now run:

    service apache2 reload
    

    and done.

    or create the default.conf file if you don't have it and this is what it should contain by default:

    <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 /var/log/apache2/error.log
    
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
    
        CustomLog /var/log/apache2/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>