Nginx, PHP, FastCGI and multiple CodeIgniter apps

Felipe Oliveira Carvalho felipekde at gmail.com
Mon Jan 26 21:10:17 MSK 2009


Hi!

I'm starting to use nginx and I'm liking. But I can't get my
CodeIgniter apps working properly.

I was using Apache. To acces the apps I was using:

http:\\localhost\app1\index.php\<controller>\<action>
http:\\localhost\app2\index.php\<controller>\<action>

I can access the index.php(the default controller/view) sucesfully,
but when I click on other links the page remains the same(the default
controller/action) using this configuration:

# this conf goes inside the http section
server {
	listen   80;
	server_name  localhost;

	location / {
		root   /var/www;
		index index.html index.htm index.php;
	}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	location ~ \.php$ {
		include fastcgi_params;
		root /var/www;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	}

    # --->
	location /clic {
    	index index.php;
		root  /var/www;

		if ($request_filename !~ (js|css|images|imgs|robots\.txt|index\.php) ) {
			rewrite ^/clic/(.*)$ /clic/index.php/$1 last;
		}
	}

	location ~ /clic/index.php {
	   	include fastcgi_params;
	    fastcgi_param  SCRIPT_FILENAME  /var/www/clic/index.php;
	}
    # --->


	#error_page  404  /404.html;
	# redirect server error pages to the static page /50x.html
	error_page   500 502 503 504  /50x.html;
	location = /50x.html {
		root   /var/www;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	location ~ /\.ht {
		deny  all;
	}
}





More information about the nginx mailing list