D
D
Dmitry Bychkov2020-11-02 21:55:43
Nginx
Dmitry Bychkov, 2020-11-02 21:55:43

Wordpress how to move wp-admin to nginx?

There is a domain: admin.site.shop
And an admin panel at: admin.site.shop/wp-admin/
How can I move the admin panel to the root of the site? So that when opening the site address, there is immediately authorization in the admin panel.
I use /wp-json/ in my project. This address must remain. php fpm config.

server {
    listen 80;
    listen [::]:80;
    root /var/www/admin.site.shop/wordpress;
    index  index.php;
    server_name admin.site.shop;

    access_log /var/www/admin.site.shop/logs/access.log;
    error_log /var/www/admin.site.shop/logs/error.log;

     client_max_body_size 100M;

     location /wp-admin/admin-ajax.php {
       allow all;
     }

    location /wp-admin {
        try_files $uri $uri/ /index.php?$args;
    }
    location /wp-json {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question