I have a Wordpress site on Cpanel with litespeed on domain http://sub.domain1.com. I wanted to bring this behind a reverse proxy on https://domain2.com/sub/. here is my configuration:


           location /sub/ {

            proxy_pass http://sub.domain1.com/;
            proxy_set_header Host sub.domain1.com;

            proxy_redirect off;
            proxy_hide_header "Cache-Control";
            add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
            proxy_hide_header "Pragma";
            add_header Pragma "no-cache";
            expires -1;
            add_header Last-Modified $sent_http_Expires;
            #proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            #proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header  X-Forwarded-Proto  $scheme;

and on wordpress wp-config.php file:

define('WP_SITEURL', 'https://domain2.com/sub/');
define('WP_HOME', 'https://domain2.com/sub/');

Now the front-end is working fine and all links are working. But when I try to login to my wordpress admin area nothing happens. No errors on error_log and nothing on the screen. What is the problem with my configuration?

  • add this to wp-config.php also didn't work: if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $ips[0]; } – ehsan Aug 4 '20 at 4:52

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.