Thursday 15 May 2014

linux - Nginx not redirecting to 404 page -


Tried to use the following code, but the website redirects to the default page not only on the 404 error page

  servers {80 listen to default_services; Listen [::]: 80 default_server ipv6only = on; Root / usr / share / nginx / html; Index index index.htm index.php; # Accessible from http: // localhost / server_name localhost; The first attempt to make the request as the location / {# file, then come back as the # directory, then display 404. Try_files $ uri $ uri / /404.html; 192.168.1.127; 127.0.0.1; Deny everyone; # To enable naxsi at this place # include simulation # /etc/nginx/naxsi.rules} for nginx-naxsi used with # nginx-naxsi-ui: Process Declined request # location / requested Is # # proxy_pass http://127.0.0.1: 8080; #} #error_page 404 / 404.html; #Redirect the server page to a static page /50x.html # #error_page 500 502 503 504 / 50x.html; #location = /50x.html {# root / usr / share / nginx / html; #} # 127.0.0.1:9000 # #location ~ \ .php $ {# fastcgi_split_path_info ^ (. + Ph.) (/.+) $; Passing PHP scripts on the FastCGI server # Note: You have "cgi.fix_pathinfo = 0;" Should be # php5-cgi in Php.ini as well: # fastcgi_pass 127.0.0.1:9000; ## with php5-fpm: # fastcgi_pass unix: /var/run/php5-fpm.sock; # Fastcgi_index index.php; # Includes fastcgi_params; #} # .htaccess denies access to files, if Apache's document denies Root # NGN # # location # / location.ht {# to ​​all; #}}   

The new brand for the server, all help is really appreciated. In addition, I was following this guide:

Firstly, I index rules, initially, index.php , you do not have any php handling engine in the config now, do you have Fastcgi or FPM installed on the server?

Change Index index.html index.htm index.php;

to

  index index.php index.html;  The php engine should have a php server as a normal file, without nginx, either it should print the data on the browser. Or you get the prompt to download the php file.   

No comments:

Post a Comment