mercredi 3 février 2016

Unable to set dev.example.com instead of example.dev in Apache config files

I want to have my projects in folders like

dev.example.com

instead of

example.dev

and the reason being is that I have some projects that are i.e. example.com, example.org, example.de etc. and to track them is easier if the folder and url structure is like dev.example.com and I see the whole url even in the future.

The problem is that I am unable to use such url in my config, or I don't know how to do it in Apache config file for my domain.

So, I have the projects in

/var/www/work/client-prague-travel/dev.prague-travel.com
/var/www/work/client-prague-travel/dev.prague-travel.de
/var/www/work/client-prague-travel/dev.prague-travel.cz
/var/www/work/client-prague-travel/dev.prague-travel.es

and I guess the /etc/hostsfile should look like this:

127.0.0.1 dev.prague-travel.com
127.0.0.1 dev.prague-travel.de
127.0.0.1 dev.prague-travel.cz
127.0.0.1 dev.prague-travel.es

but what about files in the /etc/apache2/sites-available/ directory?

I have tried to create files like:

/etc/apache2/sites-available/dev.prague-travel.com.conf
/etc/apache2/sites-available/dev.prague-travel.de.conf
/etc/apache2/sites-available/dev.prague-travel.cz.conf
/etc/apache2/sites-available/dev.prague-travel.es.conf

And put this into dev.prague-travel.com.conf:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName dev.prague-travel.com
    # ServerAlias dev.prague-travel.com
    DocumentRoot /var/www/work/client-prague-travel/http://ift.tt/1S182Wc
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

and into dev.prague-travel.de.conf:

<VirtualHost *:80>
    ServerAdmin admin@example.de
    ServerName dev.prague-travel.de
    # ServerAlias dev.prague-travel.de
    DocumentRoot /var/www/work/client-prague-travel/http://ift.tt/1medpmX
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

etc.

Then I a2ensite dev.prague-travel.com.conf and the others so they are in the sites-enabled folder now.

However, I cannot see the index.html file when I type:

http://ift.tt/1S182Wg in the browser.

I did service apache2 restart but I am getting 404 page.

It's loaded quick, so, I guess there is only some glitch in my configuration or I did forget to do something.

Any idea what am I missing?




Aucun commentaire:

Enregistrer un commentaire