1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Nginx return 404 custom in IF statement

Discussion in 'Nginx' started by Hinze, Jul 26, 2016.

  1. #2
    I configured my page 404

    error_page 404 /erreur/404;

    Everything works well, except when I return 404 in if statement, I get the 404 not found by Nginx.

    My code:

    location ~ \.php$
    {
        if ($request_uri ~* \.php) # Block direct acces to [files].php
        {
            return 404;
        }
    
       fastcgi_intercept_errors on;
       try_files $uri =404;
       fastcgi_pass 127.0.0.1:9000;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    Code (markup):
     
    Last edited by a moderator: Jul 26, 2016
    Hinze, Jul 26, 2016 IP