By mhcoding1
I configured my WordPress website on Nginx and everything works fine but for non-existent .php pages Those return the nginx default 404 page not found why ?
location / { #try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ .php$ { include snippets/fastcgi-php.conf;
# With php7.4-fpm:
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @mhcoding1,
You can configure a custom 404 page if you wish. You can follow this DigitalOcean tutorial :
Don’t mind it’s old, you can still reuse the code from the server blocks such as
error_page 500 502 503 504 /custom_50x.html;
location = /custom_50x.html {
root /usr/share/nginx/html;
internal;
}
location /testing {
fastcgi_pass unix:/does/not/exist;
}
Regards, KFSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.