Because my VirtualHosts point to the root folder.

0

I'm using Apache 2 in Ubuntu 14.04 . I moved the www/html folder to my other /media/Dados/www partition. But that's not the problem.

The problem starts when I set a vhost to a subdirectory:

Subdirectory: /media/Dados/www/ak-vitrine

Archive on sites-available:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName ak-vitrine.dev
    ServerAlias www.ak-vitrine.dev

    DocumentRoot "/media/Dados/www/AK-Vitrine"

    <Directory "/media/Dados/www/AK-Vitrine">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

When you access link it shows me the list of folders in the root /media/Dados/www/ folder. How to solve?

    
asked by anonymous 23.10.2014 / 21:07

2 answers

1

I even got the solution after a lot of research. First I used the command:

sudo a2dissite 000-default.conf

This disables the default virtualhost of apache (usually what is written "Its Works")

By doing this, you simply create the virtualhost, paying attention to include the .conf extension in the site-available and site-enabled files. To facilitate I have created a bash for the creation without error (at least in the same environment) of virtualhost.

To do this use the terminal:

sudo gedit /usr/local/bin/addvhost

and paste the content from link

Then just run the terminal sudo addvhosts to add a vhost. It will ask you the name of the project and the directory, creating the necessary files and restarting apache.

I hope this information is useful to someone. :)

    
24.10.2014 / 03:00
0

Possibly the directory is without permission, or as Bruno said, it must be case sensitive in the name of your directory.

    
23.10.2014 / 22:29