![]() |
Tutorial problem with NGINX...? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9) +--- Thread: Tutorial problem with NGINX...? (/showthread.php?tid=70390) |
Tutorial problem with NGINX...? - ryan_f - 04-03-2018 I just downloaded the latest version of CodeIgniter(3.1.8). I'm using MAMP with Nginx and PHP 7.1.12. I have successfully accessed the "Welcome to CodeIgniter" view at http://localhost:7888/codeigniter3/ (or localhost:7888/codeigniter3/index.php) However, when I try to see the newly created page in the tutorial at http://localhost:7888/codeigniter3/index.php/Pages/view(or index.php/pages/view) I get 404 Not Found
nginx/1.13.2
Any help would be greatly appreciated. RE: Tutorial problem with NGINX...? - ryan_f - 04-03-2018 In the Nginx Error Log I'm getting the following: [error] 25962#0: *29 open() "/Applications/MAMP/htdocs/codeigniter3/index.php/pages/view" failed (20: Not a directory), client: 127.0.0.1, server: , request: "GET /codeigniter3/index.php/pages/view HTTP/1.1", host: "localhost:7888". I'm thinking there's a file in MAMP or Nginx that needs to be adjusted but I can't figure out what it is...Please help! RE: Tutorial problem with NGINX...? - InsiteFX - 04-04-2018 I cannot answer your Private Message because you have it turned off. But here is a link to the tutorial that I built that works. CodeIgniter News Tutorial Working RE: Tutorial problem with NGINX...? - jreklund - 04-04-2018 This works for me in Nginx. Maybe you can find a hint here. httpd.conf Code: user nobody; conf/sites-available/localhost.conf Code: server { Code: # Global restrictions configuration file. Code: location ~* .(jpg|jpeg|gif|css|png|js|ico|txt|woff|otf|ttf|eot|svg)$ { Code: ## Only allow these request methods ## Code: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; RE: Tutorial problem with NGINX...? - ryan_f - 04-04-2018 Thanks InsiteFX...I turned on my ability to receive private messages. OK--it gets more interesting. I placed the file "ci3news" that downloaded from your link in my MAMP htdocs folder and then inside my "htdocs/CodeIgniter3" folder(I've now changed this folder name to "htdocs/beta" to simplify). Wherever I place it I get: 403 Forbidden nginx/1.13.2 Also of note, when I go to "htdocs/beta/user guide" I can access that just fine. But, the following paths all throw "403 Forbidden": "htdocs/ci3news" "htdocs/beta/ci3news" "htdocs/beta/user_guide/ci3news". In addition...if i try to just access all my folders by putting the path localhost:7888/ I also get the "403 Forbidden" RE: Tutorial problem with NGINX...? - InsiteFX - 04-04-2018 localhost is usually port 80 or 8080 Make sure you also change the base url in the config file. I'am on a Windows 10 Pro x64 system It could be a setting in your nginx RE: Tutorial problem with NGINX...? - ryan_f - 04-05-2018 Yes--it is a setting in Nginx for sure. The problem seems to be that Nginx doesn't like any url path that ends with anything that doesn't contain an index.php or index.html file. Any suggestions? RE: Tutorial problem with NGINX...? - jreklund - 04-05-2018 We need to see your configuration to make suggestions. I posted my configuration on a working NGINX setup. RE: Tutorial problem with NGINX...? - ryan_f - 04-05-2018 @Jreklund: One of the reasons I'm wondering where you got those code snippets is because at http://wiki.nginx.org/Pitfalls it says to NEVER use "if" statements in the nginx configuration file. I've also tried to incorporate the code into the nginx.config file with no success. I'm wondering if you had to make any adjustments to the Ci config file as well... ~Ryan RE: Tutorial problem with NGINX...? - jreklund - 04-05-2018 Some are taking from tutorials/documentations and some I have adapted myself. Like disabling logging of images, favicon etc. Taken from that documentation "If Is Evil": There are cases where you simply cannot avoid using an if, for example, if you need to test a variable which has no equivalent directive. PHP Code: if ($request_method = POST ) { I'm not using DELETE, PUT, SEARCH etc so if someone sends that I just drop it. https://nginx.org/en/docs/ https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/ https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/ Try if this one works for you, as it's their default recommendations. And later on add modifications. https://www.nginx.com/resources/wiki/start/topics/recipes/codeigniter/ |