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 :

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 :
but not with :

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]

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
    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"

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^([^\.]+)\.my_domain\.fr
    RewriteCond /var/www/html/%1 -l
    RewriteRule ^(.*) /%1/$1 [L]


File guacamole.conf :

<IfModule mod_proxy_http.c>
    <Location /guacamole/>
    Order allow,deny
    Allow from all
    ProxyPass flushpackets=on

    <Location /guacamole/websocket-tunnel>
    Order allow,deny
    Allow from all
    ProxyPass ws://
    ProxyPassReverse ws://

File subsonic.conf :

<IfModule mod_proxy_http.c>
    SSLProxyEngine on
    ProxyRequests Off
    ProxyPreserveHost On
    RequestHeader unset Accept-Encoding
    Order allow,deny
    Allow from all
    ProxyPass /subsonic/
    ProxyPassReverse /subsonic/

File nextcloud.conf (no need for port redirection) :

Alias /nextcloud /var/www/html/nextcloud
<Directory /var/www/html/nextcloud>
    Options +FollowSymlinks
    AllowOverride All

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, ...




Sorry but I didn't see I had some answers. I'll have a look at "How can I forward requests from my web server?".



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.