M
M
Max Georgievsky2019-02-11 09:21:41
Nginx
Max Georgievsky, 2019-02-11 09:21:41

Apache2 + nginx. The port is added to the address bar. How to fix?

Good day!
There are two virtual hosts on apache (port 8080). One of them has joomla(a.com) installed, the other has wordpress(b.com).
There is also nginx as a proxy (port 80).
System - Debian 9
When I go to a.com - everything is OK, joomla is loaded and works as it should.
When I go to b.com, wordpress loads, but the port number (b.com:8080) is added to the address bar. With further navigation through the pages, the port is saved, but if I manually remove the port while on some internal page, it is not added. Those. the port is added to the address bar only when going to b.com.
nginx config:

upstream backend {
    # Адрес back-end:
    server localhost:8080;
}

server {
    listen 80;
    server_name www.a.com a.com www.b.com b.com;
    port_in_redirect off;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Перенаправление на backend
    location / {
        proxy_pass http://backend;
        include /etc/nginx/proxy_params;
    }
}

Apache2 for a.com
<VirtualHost *:8080>

ServerName a.com
ServerAlias www.a.com
ServerAdmin [email protected]
DocumentRoot /var/www/a.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Options +ExecCGI
AddHandler cgi-script.pl AddHandler cgi-script .cgi

</VirtualHost>

Apache2 for b.com:
<VirtualHost *:8080>

ServerName b.com
ServerAlias www.b.com
ServerAdmin [email protected]
DocumentRoot /var/www/b.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Options +ExecCGI
AddHandler cgi-script .pl
AddHandler cgi-script .cgi

</VirtualHost>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2019-02-11
@mgdev

Judging by the fact that a.com works, and b.com does not work with the same nginx+apache2 configs, we can safely
conclude that the problem is not in the nginx+apache2 settings)
Obviously, applications process server variables differently.
Show what you have in include /etc/nginx/proxy_params

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question