Welcome! Log In Create A New Profile

Advanced

website/admin behind my reverse proxy doesn't work

Mik J via nginx
December 28, 2022 06:02PM
Hello,
I have a website hosted on a server using nginx behind a nginx reverse proxy but things don't work properly.
https://mywebsite.org => workshttps://mywebsite.org/admin => doestn't work it redirects to https://mywebsite.org

On my backend serverserver {
        listen 80;
        server_name mywebsite.org ;        index index.php;
        root /var/www/htdocs/sites/mywebsite;...        location / {
          try_files $uri $uri/ /index.php$is_args$args;

          location ~ \.php$ {
              root           /var/www/htdocs/sites/mywebsite;              try_files $uri =404;
              fastcgi_pass   unix:/run/php-fpm.mywebsite.org.sock;              fastcgi_split_path_info ^(.+\.php)(/.+)$;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
              include        fastcgi_params;
          }
        }}
On my reverse proxyserver {
#    listen 80;
#    listen [::]:80;
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name http://mywebsite.org;...
    root /var/www/htdocs/mywebsite;    location ^~ / {        proxy_pass              http://10.12.255.23:80;
        proxy_redirect          off;
        proxy_set_header        Host    $host;
        proxy_http_version 1.1;
        proxy_set_header  X-Real-IP        $remote_addr;
        proxy_set_header  X-Forwarded-Host $host;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header        Referer         "http://mywebsite.org/";        proxy_pass_header Set-Cookie;
        proxy_set_header  X-Forwarded-Proto $scheme;
    }
}


So I can't access

In the backend server logs I see[28/Dec/2022:23:54:33 +0100] "GET /admin/ HTTP/1.1" 302 5 "http://mywebsite.org/" ...[28/Dec/2022:23:54:33 +0100] "GET / HTTP/1.1" 499 0 "http://mywebsite.org/" ...

Regards

_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

website/admin behind my reverse proxy doesn't work

Mik J via nginx December 28, 2022 06:02PM

Re: website/admin behind my reverse proxy doesn't work

Maxim Dounin December 29, 2022 06:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 142
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready