Apache24 & Nginx as reverse proxy - weird behavior of vhosts

Hello guys,

I have a weird problem which i really don't understand it. I was trying to many times to reconfigure vhosts. My vhosts show diffrent patch then has been set.

Code:
<VirtualHost *:8080>
        ServerAdmin admin@example.org
        ServerName aix.proton.edu.pl
        ServerAlias www.aix.proton.edu.pl
        DocumentRoot "/home/aix/domains/aix.proton.edu.pl"
        <Directory /home/aix/domains/aix.proton.edu.pl>
       Options +Indexes
                AllowOverride None
           Require all granted
   </Directory>
</VirtualHost>
<VirtualHost *:8080>
        ServerAdmin admin@example.org
        ServerName bryn1u.proton.edu.pl
        ServerAlias www.bryn1u.proton.edu.pl
        DocumentRoot "/home/bryn1u/domains/bryn1u.proton.edu.pl"
        <Directory /home/bryn1u/domains/bryn1u.proton.edu.pl>
       Options +Indexes
                AllowOverride None
           Require all granted
   </Directory>
</VirtualHost>
<VirtualHost *:8080>
        ServerAdmin admin@example.org
        ServerName rockcat.proton.edu.pl
        ServerAlias www.rockcat.proton.edu.pl
        DocumentRoot "/home/rockcat/domains/rockcat.proton.edu.pl"
        <Directory /home/rockcat/domains/rockcat.proton.edu.pl>
       Options All +Indexes
                AllowOverride None
           Require all granted
   </Directory>
</VirtualHost>

Code:
root@proton:/usr/local/etc/apache24/Includes/vhosts # httpd -S
VirtualHost configuration:
*:8080                   is a NameVirtualHost
         default server aix.proton.edu.pl (/usr/local/etc/apache24/Includes/vhosts/aix.conf:1)
         port 8080 namevhost aix.proton.edu.pl (/usr/local/etc/apache24/Includes/vhosts/aix.conf:1)
                 alias www.aix.proton.edu.pl
         port 8080 namevhost bryn1u.proton.edu.pl (/usr/local/etc/apache24/Includes/vhosts/bryn1u.conf:1)
                 alias www.bryn1u.proton.edu.pl
         port 8080 namevhost rockcat.proton.edu.pl (/usr/local/etc/apache24/Includes/vhosts/rockcat.conf:1)
                 alias www.rockcat.proton.edu.pl
ServerRoot: "/usr/local"
Main DocumentRoot: "/usr/local/www/apache24/data"
Main ErrorLog: "/var/log/httpd-error.log"
Mutex proxy: using_defaults
Mutex default: dir="/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www" id=80
Group: name="www" id=80
root@proton:/usr/local/etc/apache24/Includes/vhosts #

I have installed nginx as a reverse proxy. There is nothing special. Default nginx config + content below:
Code:
        location / {
            root   /usr/local/www/nginx;
            index  index.html index.htm;

        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8080;
        }
That's all.

And the funny thing is:
proton.edu.pl - shows main site from /usr/local/www/apache24/data
aix.conf - shows main site from /usr/local/www/apache24/data
bryn1u.conf - shows correcly
rockcat.conf - shows blank white page

But when i turned off nginx and changed port from 8080 on 80 it works well. Someone can tell me what's wrong ?
 
... and changed port from 8080 on 80 it works well. Someone can tell me what's wrong ?

Check whether Apache is really listening on port 8080 on a suitable interface:
# sockstat | grep httpd

If not, then place the following at the top of your vhosts file:
Code:
Listen 8080
...
 
Hey,

Code:
[root@proton /]# sockstat -4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS    
www      httpd      43109 3  tcp4   79.137.56.144:8080    *:*
www      httpd      91854 3  tcp4   79.137.56.144:8080    *:*
www      httpd      35722 3  tcp4   79.137.56.144:8080    *:*
www      httpd      83780 3  tcp4   79.137.56.144:8080    *:*
www      httpd      76144 3  tcp4   79.137.56.144:8080    *:*
root     httpd      61958 3  tcp4   79.137.56.144:8080    *:*
www      nginx      25488 6  tcp4   79.137.56.144:80      *:*
root     nginx      90900 6  tcp4   79.137.56.144:80      *:*
root     sendmail   32748 3  tcp4   79.137.56.144:25      *:*
root     syslogd    31379 6  udp4   79.137.56.144:514     *:*
?        ?          ?     ?  tcp4   79.137.56.144:80      46.76.150.165:51066
[root@proton /]#
All subdomains bryn1u.proton.edu.pl, rockcat.proton.edu.pl, aix.proton.edu, proton.edu.pl point redirecting on ---> aix.proton.edu.pl
I have removed all and reinstalled apache24. I have change only port from 80 to 8080 and put all vhosts to the one file. That's all.
Code:
[root@proton /usr/local/etc/apache24/Includes]# cat vhost.conf
<VirtualHost *:8080>
        ServerAdmin admin@example.org
        ServerName aix.proton.edu.pl
        ServerAlias www.aix.proton.edu.pl
        DocumentRoot "/home/aix/domains/aix.proton.edu.pl"
        <Directory /home/aix/domains>
       Options +Indexes
                AllowOverride None
           Require all granted
   </Directory>
</VirtualHost>
<VirtualHost *:8080>
        ServerAdmin admin@example.org
        ServerName bryn1u.proton.edu.pl
        ServerAlias www.bryn1u.proton.edu.pl
        DocumentRoot "/home/bryn1u/domains/bryn1u.proton.edu.pl"
        <Directory /home/bryn1u/domains>
       Options +Indexes
                AllowOverride None
           Require all granted
   </Directory>
</VirtualHost>
<VirtualHost *:8080>
        ServerAdmin admin@example.org
        ServerName rockcat.proton.edu.pl
        ServerAlias www.rockcat.proton.edu.pl
        DocumentRoot "/home/rockcat/domains/rockcat.proton.edu.pl"
        <Directory /home/rockcat/domains/rockcat.proton.edu.pl>
       Options All +Indexes
                AllowOverride None
           Require all granted
        </Directory>
</VirtualHost>
[root@proton /usr/local/etc/apache24/Includes]#

I dont see any errors in httpd-error.log. What am i doing wrong ?? Could it be something wrong with nginx entry ?? I put it from:
https://www.nginx.com/resources/wiki/start/topics/examples/likeapache/
Code:
[root@proton /var/log]# httpd -S
VirtualHost configuration:
*:8080                 is a NameVirtualHost
         default server aix.proton.edu.pl (/usr/local/etc/apache24/Includes/vhost.conf:1)
         port 8080 namevhost aix.proton.edu.pl (/usr/local/etc/apache24/Includes/vhost.conf:1)
                 alias www.aix.proton.edu.pl
         port 8080 namevhost bryn1u.proton.edu.pl (/usr/local/etc/apache24/Includes/vhost.conf:12)
                 alias www.bryn1u.proton.edu.pl
         port 8080 namevhost rockcat.proton.edu.pl (/usr/local/etc/apache24/Includes/vhost.conf:23)
                 alias www.rockcat.proton.edu.pl
ServerRoot: "/usr/local"
Main DocumentRoot: "/usr/local/www/apache24/data"
Main ErrorLog: "/var/log/httpd-error.log"
Mutex proxy: using_defaults
Mutex default: dir="/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www" id=80
Group: name="www" id=80
[root@proton /var/log]#

 
Back
Top