nginx progy pass doesn’t work in WordPress admin

I have two web sites urls like example.com and wp-example.site.cloud. wp-example is WordPress blog of example.com and I want to open it in example.com/blog so I did it in example.com nginx.

location ^~ /blog {

        rewrite /blog/(.*) /$1  break;
        proxy_http_version 1.1;
       proxy_set_header Host $http_host;
        proxy_request_buffering off; # Disable any internal request bufferring.
        proxy_pass http://wp.lunato;
        server_name_in_redirect off;
     #   proxy_set_header Host $host:$server_port;

    }

It works fine but when I open WordPress admin the blog is removed from url and return 404 for me. The main page of WordPress is fine but when I open a page from menu there is no /blog in the url and returns 404. Any idea for this problem?

Leave a Comment