Apache alias for subdomains

Alles, was den Apache betrifft, kann hier besprochen werden.

Apache alias for subdomains

Postby pacifer » 20. October 2021 06:38

I am looking for a solution. I am building a webpage and cut it to a live and development system. The live system is reachable via (www.)schluetert.de/admin/ and the development system via dev.schluetert.de/admin.php

My Problem now is that I cant use /admin/ for the development system, because of this configuration:

Code: Select all
Alias /admin /var/www/schluetert

<Directory /var/www/schluetert>
    Options SymLinksIfOwnerMatch
    DirectoryIndex admin.php

</Directory>


How is it possible to react to the subdomain in this configuration?
pacifer
 
Posts: 2
Joined: 20. October 2021 06:37
Operating System: Ubuntu Server

Re: Apache alias for subdomains

Postby Altrea » 20. October 2021 06:46

You can define Alias in virtualhosts too.
So each subdomain should have a virtualhost and each of them can have an Alias pointing to different directories.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Apache alias for subdomains

Postby pacifer » 20. October 2021 07:17

So easy... thank you!

For all that searchs for that. This is my configuration as example:

Code: Select all
<IfModule mod_ssl.c>

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName dev.example.de
    ServerAlias dev.example.de
    DocumentRoot /var/www/entwicklung
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Alias /admin /var/www/entwicklung
    <Directory /var/www/entwicklung>
    Options SymLinksIfOwnerMatch
    DirectoryIndex admin.php
    </Directory>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/schluetert.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/schluetert.de/privkey.pem
</VirtualHost>



<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName example.de
    ServerAlias www.example.de
    DocumentRoot /var/www/example
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Alias /admin /var/www/example
    <Directory /var/www/example>
    Options SymLinksIfOwnerMatch
    DirectoryIndex admin.php
    </Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/schluetert.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/schluetert.de/privkey.pem
</VirtualHost>


</IfModule>


pacifer
 
Posts: 2
Joined: 20. October 2021 06:37
Operating System: Ubuntu Server


Return to Apache

Who is online

Users browsing this forum: No registered users and 12 guests