0

i am trying to redirect from nginx port 8100 to 8069. i have apache2 running on 443 and 80. No matter what i try as a proxy_pass i always end up on port 443.

pi@nextcloudpi:/etc/nginx/conf.d $ sudo lsof -nP -iTCP:8100 -sTCP:LISTEN
COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   3009     root   10u  IPv4  35397      0t0  TCP *:8100 (LISTEN)
nginx   3010 www-data   10u  IPv4  35397      0t0  TCP *:8100 (LISTEN)
nginx   3011 www-data   10u  IPv4  35397      0t0  TCP *:8100 (LISTEN)
nginx   3012 www-data   10u  IPv4  35397      0t0  TCP *:8100 (LISTEN)
nginx   3013 www-data   10u  IPv4  35397      0t0  TCP *:8100 (LISTEN)
pi@nextcloudpi:/etc/nginx/conf.d $ sudo lsof -nP -iTCP:443 -sTCP:LISTEN
COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apache2  851     root    6u  IPv6  20709      0t0  TCP *:443 (LISTEN)
apache2 1372 www-data    6u  IPv6  20709      0t0  TCP *:443 (LISTEN)
apache2 1373 www-data    6u  IPv6  20709      0t0  TCP *:443 (LISTEN)
pi@nextcloudpi:/etc/nginx/conf.d $ sudo lsof -nP -iTCP:8069 -sTCP:LISTEN
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
python3 2176 odoo    4u  IPv4  24012      0t0  TCP *:8069 (LISTEN)
pi@nextcloudpi:/etc/nginx/conf.d $

I have used the most simple reverse proxy code:

server {
        listen 8100;
           
        access_log /var/log/nginx/reverse-access.log;
        error_log /var/log/nginx/reverse-error.log;
            
        location / {
        proxy_set_header Host $host;
        proxy_set_header User-Agent $http_user_agent;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE_ADDR $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://localhost:8069;
  }
}

any suggestions?

4
  • The nginx config you posted is fine. It's time to look at the backend application. Jan 21, 2021 at 17:09
  • @michael: I was wondering if it could have anything to do with the fact that they are different users. (Www-data and odoo) but I wouldn't know and if so, how to set it than. I went to every single webpage about nginx and odoo. It should simply work but it doesn't. Are users the problem? Should I have installed nginx as odoo user? Odoo is set up under folder /opt/odoo and config under /etc/odoo-server. Can user www-data redirect to a folder it doesn't own? A lot of questions and no Google answer.
    – Stephane
    Jan 21, 2021 at 17:30
  • What does the user have to do with anything? Jan 21, 2021 at 18:54
  • @michael m: Well that answers the question. Apparently nothing :) I am trying to learn and understand this. So thinking the user had something to do with it is plain wrong. How would you suggest I examine the problem, if I may ask?
    – Stephane
    Jan 21, 2021 at 19:22

0

Your Answer

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

Browse other questions tagged or ask your own question.