I know my problem has already been described (see How do I redirect subdomains to a different port on the same server? for ex) but as I can't make it work on my side, I ask for some help again.
I have an Apache server running.
I can access to all the different web softwares which are running on this server trough subdomains.
Ex :
https://nextcloud.my_domain.fr
https://roundcube.my_domain.fr
...
At my ISP provider side, I have the following :
nextcloud A 10800 xx.xx.xx.xx
subsonic A 10800 xx.xx.xx.xx
I said "all" softwares but this is not true. I can't do the same for sub-domains I want to redirect to specific ports.
For ex, subsonic needs port 4040.
I can access to subsonic with :
https://my_domain.fr/subsonic
but not with :
https://subsonic.my_domain.fr
I can remove the port 4040 in the field, this is better than nothing, but I want more :)
I have the same issue for filebrowser (port 8082), guacamole (port 8080), ...
To remove the port in the address field, I have the following configuration files in the directory /etc/httpd/conf/sites.d :
File 00_default_vhosts.conf :
<VirtualHost *:80>
ServerName my_domain.fr
ServerAdmin xuo@my_domain.fr
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
RewriteEngine On
File 00_default_ssl_vhost.conf
<VirtualHost *:443>
# general configuration
ServerAdmin xuo@my_domain.fr
ServerName my_domain.fr
# SSL configuration
SSLEngine on
SSLCertificateFile /etc/certificates/server.crt
SSLCertificateKeyFile /etc/certificates/server.pem
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder on
AllowEncodedSlashes NoDecode
CustomLog logs/ssl_request_log \
"%V %t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^\.]+)\.my_domain\.fr
RewriteCond /var/www/html/%1 -l
RewriteRule ^(.*) /%1/$1 [L]
</VirtualHost>
File guacamole.conf :
<IfModule mod_proxy_http.c>
<Location /guacamole/>
Order allow,deny
Allow from all
ProxyPass http://192.168.0.14:8080/guacamole/ flushpackets=on
ProxyPassReverse http://192.168.0.14:8080/guacamole/
</Location>
<Location /guacamole/websocket-tunnel>
Order allow,deny
Allow from all
ProxyPass ws://192.168.0.14:8080/guacamole/websocket-tunnel
ProxyPassReverse ws://192.168.0.14:8080/guacamole/websocket-tunnel
</Location>
</IfModule>
File subsonic.conf :
<IfModule mod_proxy_http.c>
SSLProxyEngine on
ProxyRequests Off
ProxyPreserveHost On
RequestHeader unset Accept-Encoding
<Proxy http://192.168.0.14:4040/subsonic/>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /subsonic/ http://192.168.0.14:4040/subsonic/
ProxyPassReverse /subsonic/ http://192.168.0.14:4040/subsonic/
</IfModule>
File nextcloud.conf (no need for port redirection) :
Alias /nextcloud /var/www/html/nextcloud
<Directory /var/www/html/nextcloud>
Options +FollowSymlinks
AllowOverride All
</Directory>
The "best" I could achieve (and I don't remember how), was to get the subsonic main page on both https://subsonic.my_domain.fr AND https://my_domain.fr
Does anyone know how to make the subdomain + port redirection work together ? Note that I have several subdomains, so my goal is to be able to use nextcloud.my_domain.fr, subsonic.my_domain.fr, guacamole.my_domain.fr, ...
Regards.
Xuo.