Question

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?

Was it helpful?

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>

OTHER TIPS

The simple way of doing it is adding your .conf file or your virtual host configurations to the site-available folder and then when in the folder and then try again. Worked for me.

I had the same problem, so I tried changing my virtual host configuration file name from default to default.conf, as mentioned here, and it was still not working.

At last i got it. It is necessary also to change the code:

Order allow,deny
Allow from all

to

Require all granted

http://httpd.apache.org/docs/2.4/upgrading.html

After that, I've restarted apache and it worked again

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top