On Fri, Dec 15, 2023 at 2:57 AM Gestió Servidors <sysadmin.c...@uab.cat.invalid> wrote:
> Hello, > > > > I have a small Apache where I run a redirection to two private hosts. My > machine (R, router) is connected to Interned and to a private LAN > (192.168.x.x/16). Behind “R”, there are two machines (A and B) that are > serving two websites. R has an DNS alias with two public DNS names for A > and B (because some years ago, A and B were machines with public IP > addresses). Now, I want to change R and configure a new R machine (newest > distribution). However, in new R, redirect doesn’t run and I can’t get > browing from Internet to A and B websites. I copypaste here all information: > > > > - R: > - CentOS-7.9.2009 > - Apache: 2.4.6-99.el7.centos.1 > - new R: > - Rocky Linux 8.9 > - Apache: 2.4.37-62.module+el8.9.0+1436+2b7d5021 > > > > My configuration file where I have configured “VirtualHost” is the same in > both servers: > > > > <VirtualHost A.mydomain:80> > > ServerAdmin foo@boo <sysadmin.c...@uab.cat> > > ServerName A.mydomain > > ServerAlias A A.mydomain > > LogLevel info > > ErrorLog /var/log/httpd/virtualhost-A.log > > ProxyPass / http://192.168.1.2/ > > ProxyPassReverse / http://192.168.1.2/ > > <Location /> > > <RequireAny> > > Require ip my_network > > </RequireAny> > > </Location> > > > > <Directory /> > > Options FollowSymLinks > > AllowOverride None > > </Directory> > > <Directory /var/www/html/> > > Options Indexes FollowSymLinks MultiViews > > AllowOverride all > > <RequireAny> > > Require ip my_network > > </RequireAny> > > </Directory> > > </VirtualHost> > > > > <VirtualHost B.mydomain:80> > > ServerAdmin foo@boo <sysadmin.c...@uab.cat> > > ServerName B.mydomain > > ServerAlias B B.mydomain > > LogLevel info > > ErrorLog /var/log/httpd/virtualhost-B.log > > ProxyPass / http://192.168.1.5/ > > ProxyPassReverse / http://192.168.1.5/ > > <Location /> > > <RequireAny> > > Require ip my_network > > </RequireAny> > > </Location> > > > > <Directory /> > > Options FollowSymLinks > > AllowOverride None > > </Directory> > > <Directory /var/www/html/> > > Options Indexes FollowSymLinks MultiViews > > AllowOverride all > > <RequireAny> > > Require ip my_domain > > </RequireAny> > > </Directory> > > </VirtualHost> > > > > With this file, in server R, redirection runs perfectly and when I browse > http://A/mysiteA, R redirect connection to private machine A (the same > when I browse to http://B/mysiteB). However, in new R, when I browse to > http://A/mysiteA (or http://B/mysiteB), there are no redirection and I > can see at logs this message: File does not exist: /var/www/html/mysiteA > (or File does not exist: /var/www/html/mysiteB). > > > > Where is the problem? > > > > Thanks! > > > You don't want to define a vhost as <hostname>:<port>, unless you know exactly what you are doing. When unsure, always use *:<port>. Show the output from apachectl -S or httpd -S after you applied the fixes.