How to fix WordPress Wp-admin not found NGINX

If you decided to move from apache to nginx due to the speed at its disposal you will notice that some errors come up at your wordpress functionality because you need to make some settings in the configuration file of your server in nginx. 

I had the same issue after installing the nginx on my server. All pages go well less the admin dashboard and all pages from admin because a 404 error comes up when I access wp-admin. IN order to solve this issue I had to make the following settings in my conf file. 

So the following settings are working for Cent os 7. I don't know if it will work for version 6 but you can try. Open the terminal using putty or any other editor you like and go to /etc/nginx/conf.d here you will have to find or create a new configurabile file for your domain/server. If you don't have this file you can try to edit the settings in /etc/nginx/nginx.conf. Here should be listed all domains you have on the server.


Fix wordpress 404 wp-admin nginx

The settings should look like the following:

 location / {
           try_files $uri $uri/ /index.php?$args;

           # time out settings
           fastcgi_read_timeout 120;
           proxy_connect_timeout 159s;
           proxy_send_timeout   600;
           proxy_read_timeout   600;
           proxy_buffer_size    64k;
           proxy_buffers     16 32k;
           proxy_busy_buffers_size 64k;
           proxy_temp_file_write_size 64k;
           proxy_pass_header Set-Cookie;
           proxy_hide_header  Vary;
           proxy_set_header   Accept-Encoding '';
           proxy_ignore_headers Cache-Control Expires;
           proxy_set_header   Referer $http_referer;
           proxy_set_header   Host   $host;
           proxy_set_header   Cookie $http_cookie;
           proxy_set_header   X-Real-IP  $remote_addr;
           proxy_set_header X-Forwarded-Host $host;
           proxy_set_header X-Forwarded-Server $host;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        location ~ \.php$ {
           fastcgi_pass unix:your url to .sock file;

           include fastcgi.conf;
           fastcgi_intercept_errors on;

           fastcgi_index index.php;

The error is 404 for wp-admin is because you have a bad location {} configuration, try to remove from these blocks directives and check if is working, or just try to replace the entire block with mine and see if is working. Don't forget to restart the nginx after you made this changes. To restart nginx use the following command as root systemctl restart nginx.

Let me know if this worked for you.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x