j.kaspar Posted August 17, 2017 Share Posted August 17, 2017 (edited) Hi, I want to move my PS 1.6 to server with nginx. I am currently tuning the vhost file, to replace all features in apache's .htaccess What I have problem with now, is redirection to error page (404). I want to use standard page, as is in default theme (404.tpl). I am not able to find a way how to actually call it. I know, that the page is a product of pagenotfoundcontroller.php and 404.tpl template, but have no idea how to call it. What will the URI look like. Could someone please advise? Thank you Edited September 11, 2017 by j.kaspar (see edit history) Link to comment Share on other sites More sharing options...
j.kaspar Posted August 17, 2017 Author Share Posted August 17, 2017 I don´t need any module. The page is there in apache, it must be possible to call it in nginx.... Link to comment Share on other sites More sharing options...
Scully Posted August 18, 2017 Share Posted August 18, 2017 Look for this line in your nginx config: error_page 404 /index.php?controller=404; Link to comment Share on other sites More sharing options...
j.kaspar Posted August 18, 2017 Author Share Posted August 18, 2017 Scully, thank you. Actually I tried this method, because despite I don't precisely know what it does, I saw it in the original .htaccess. But this method ended up in error 500 because of "rewrite or internal redirection cycle while internally redirecting to "/index.php" while sending to client". That, i believe, is due to this directive: location @php { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/lib/php7.0-fpm/web3.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } do you have experience with it? Do you see a way out? Thank you Link to comment Share on other sites More sharing options...
j.kaspar Posted September 10, 2017 Author Share Posted September 10, 2017 (edited) In the end, the solution was simple. The "main" @php location should look like this: (only the first line is important in this context) location @php { try_files $uri /index.php?controller=404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/lib/php7.0-fpm/web6.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } and then, the error pages doesn't contain the 404 error_page 400 /error/400.html; error_page 401 /error/401.html; error_page 403 /error/403.html; error_page 405 /error/405.html; error_page 500 /error/500.html; error_page 502 /error/502.html; error_page 503 /error/503.html; error_page 504 /error/504.html; recursive_error_pages on; location = /error/400.html { internal; } location = /error/401.html { internal; } location = /error/403.html { internal; } location = /error/405.html { internal; } location = /error/500.html { internal; } location = /error/502.html { internal; } location = /error/503.html { internal; } location = /error/504.html { internal; } this way, the dead loop is avoided. Every 404 ends up on the prestashop's /index.php?controller=404, and other error pages are pure html. Scully, thank you. Actually I tried this method, because despite I don't precisely know what it does, I saw it in the original .htaccess. But this method ended up in error 500 because of "rewrite or internal redirection cycle while internally redirecting to "/index.php" while sending to client". That, i believe, is due to this directive: location @php { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/lib/php7.0-fpm/web3.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } do you have experience with it? Do you see a way out? Thank you Edited September 10, 2017 by j.kaspar (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted September 11, 2017 Share Posted September 11, 2017 Thank you for the feedback. You might add 'SOLVED' to your topic title. Have a great day. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now