Welcome Guest, Not a member yet? Register   Sign In
Anyone use CI with Nginx?
#5

[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 {
  listen PORT;
  server_name NAME;
  root ROOT;

  location / {
    index index.php;

    if (-e $request_filename) {
      break;
    }

    if (!-e $request_filename) {
      rewrite ^(.*)$ /index.php?q=$1 last;
    }
  }

  location ~ \.php$ {
    if (!-f $request_filename) {
      return 404;
    }

    fastcgi_pass  127.0.0.1:PORT;
    fastcgi_index index.php;

    include FASTCGI_PARAMS;
  }
}

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;
fastcgi_param SCRIPT_NAME     $fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT   $document_root;

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.


Messages In This Thread
Anyone use CI with Nginx? - by El Forum - 09-05-2008, 06:59 PM
Anyone use CI with Nginx? - by El Forum - 09-05-2008, 08:01 PM
Anyone use CI with Nginx? - by El Forum - 09-05-2008, 08:04 PM
Anyone use CI with Nginx? - by El Forum - 09-05-2008, 08:25 PM
Anyone use CI with Nginx? - by El Forum - 09-05-2008, 10:40 PM
Anyone use CI with Nginx? - by El Forum - 10-04-2008, 10:54 PM
Anyone use CI with Nginx? - by El Forum - 04-19-2009, 07:18 PM
Anyone use CI with Nginx? - by El Forum - 07-13-2009, 01:44 PM
Anyone use CI with Nginx? - by El Forum - 08-10-2009, 03:53 PM
Anyone use CI with Nginx? - by El Forum - 05-06-2010, 12:40 PM
Anyone use CI with Nginx? - by El Forum - 05-06-2010, 05:35 PM
Anyone use CI with Nginx? - by El Forum - 05-24-2010, 10:11 PM
Anyone use CI with Nginx? - by El Forum - 11-24-2010, 04:34 PM
Anyone use CI with Nginx? - by El Forum - 02-28-2012, 08:20 PM
Anyone use CI with Nginx? - by El Forum - 02-28-2012, 10:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB