website/admin behind my reverse proxy doesn't work

Mik J mikydevel at yahoo.fr
Wed Dec 28 23:01:11 UTC 2022


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20221228/eff59a5c/attachment.htm>


More information about the nginx mailing list