![]() |
Anyone use CI with Nginx? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Anyone use CI with Nginx? (/showthread.php?tid=11366) Pages:
1
2
|
Anyone use CI with Nginx? - El Forum - 09-05-2008 [eluser]John Fuller[/eluser] And if so, are you able to use CI without adding the query string after index.php to view your controller methods? Looking all over the net, I see instructions on "how to get CodeIgniter to work with Nginx" but that isn't my problem. CodeIgniter works if I add the query string. I imagine this is the same problem as ExpressionEngine. I can't figure out how to configure Nginx to deliver the proper PATH_INFO information. I'm using Nginx with FastCGI if that helps. Just as with anything in the open source ecosystem, the more I Google and read the more I pick up. Unfortunately I don't have the man hours to spend on this problem to figure it out all the way. Other options are to live with the query string. Remove it using the Nginx rewrite module. Or just use Apache like every other sane individual. ![]() Anyone use CI with Nginx? - El Forum - 09-05-2008 [eluser]John Fuller[/eluser] Hm, found this thread and apparently this guy did figure out how to remove the query string from the URL. I guess I just have a configuration problem then. Ugh. Anyone use CI with Nginx? - El Forum - 09-05-2008 [eluser]Popcorn[/eluser] http://blog.skateinmars.net/post/2007/09/03/Setup-CodeIgniter-on-Nginx-server-with-fastcgi Try this one. Anyone use CI with Nginx? - El Forum - 09-05-2008 [eluser]John Fuller[/eluser] [quote author="Popcorn" date="1220684667"]http://blog.skateinmars.net/post/2007/09/03/Setup-CodeIgniter-on-Nginx-server-with-fastcgi Try this one.[/quote] Yeah, thanks. That is how I found the thread that I linked to in my second post. I suppose I should have mentioned that. ![]() I really hate configuring web servers. Actually, I think I hate administration in general. I spend more time screwing with servers than I do actually coding. Anyone use CI with Nginx? - El Forum - 09-05-2008 [eluser]thurting[/eluser] EDIT: Something like the following should work (of course you may have to mod for your setup and replace CAPS with proper values - BTW, this was ripped from one of my vhost configs and my main nginx.conf file contains much more general server config): Code: server { Also, make sure the following is set in your fastcgi_params file or you will get no input file specified (other vars must be set too - but see the manual): Code: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; Nginx can seem a bit strange at first if you are coming from Apache, but once you get the hang of it you will be amazed at how easy and intuitive the config is. You can do things really simply that are a pain with Apache. Also, compared to Apache, your RAM consumption will decrease by about 30-40% right off the bat. In any case, you should always RTFM if you want to gain expertise. Anyone use CI with Nginx? - El Forum - 10-04-2008 [eluser]John Fuller[/eluser] I just wanted to update this thread for future peeps looking to do the same thing. I did figure out how to use URL's without either the query string or the index.php. Here is a Slicehost thread where I asked the same there and figured out the issue. Basically you need to make sure that SCRIPT_FILENAME points directly to your index.php file. The other link mentioned in this thread also seems correct. Not sure why it didn't work for me until now though. As both linked areas mentioned, you also need to make the following config.php change. Code: $config['uri_protocol'] = "REQUEST_URI"; Here is a basic snippet of my Nginx config file. Code: server { Anyone use CI with Nginx? - El Forum - 04-19-2009 [eluser]Kenzie[/eluser] Here's what I've found to work best: Code: server { (Tested with Nginx 0.6.3, CodeIgniter 1.7.1) Anyone use CI with Nginx? - El Forum - 07-13-2009 [eluser]mikeyhell[/eluser] Here's another way to do this (I put all my js/css/img in a dir under the webroot called assets): Code: server { Anyone use CI with Nginx? - El Forum - 08-10-2009 [eluser]vmirjamali[/eluser] Will these work with routes and query off? atm i have to use something like this: Code: location / { For some reason though it causes my other directories like /forums/ to give 404's, any ideas? I use the cache system on ci as well if that's neded. Anyone use CI with Nginx? - El Forum - 05-06-2010 [eluser]kylemac[/eluser] Hey all, this may be an old post - but it comes up quite high in the google search so I thought I might mention that some of what you guys are doing can now be handled natively by nginx. Pay attention to the location block. Code: server { Here is the nginx documentation of try_files - http://wiki.nginx.org/NginxHttpCoreModule#try_files |