nginx proxy_pass doesn't work in wordpress admin and returns 404

  • Posted February 9, 2020
  • Nginx

i have a main domain that is and a blog service to name i need to open blog with this url : so i did this in my 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 when i open

but when i try to use admin of wordpress the /blog remove from url it’s ok when i open but /blog will remove when i open or other pages in menu of wordpress admin


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer


If you would like the Wordpress installation to be accessible via you need to set your Wordpress site and home URLs to That way your wp-admin menu would take you to the correct page.

Hope that this helps! Regards, Bobby