Skip to Content

404 error on login with nginx

How to Solve 404 Errors in Nginx?


Overview: This article provides a detailed guide on resolving 404 errors in Nginx.


Ezeelogin installation is under the directory named 'gate' 

Step 1: In the Nginx configuration, within the location directive of the server section that handles Ezeelogin pages, add the following rewrite rule:

if (!-f $request_filename) { rewrite ^/gate/index.php/(.*)$ /gate/index.php?$1 last;

The modified Nginx configuration is as follows:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name 192.168.56.126;
rewrite_log on;
root /usr/share/nginx/html;
index index.php index.html;


if (!-f $request_filename) {
rewrite ^/gate/index.php/(.*)$ /gate/index.php?$1 last;
}
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
}

error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Step 2: If the 404 error persists, enable error logging by setting the following variable in your Nginx configuration file and check for the rewrite errors in the logs.

error_log /var/log/nginx/error.log notice;

Contact support with any error messages you may have.


Related Articles

502 on login with nginx.
Configure the Nginx web server on the Jump server.