![]() |
when I change web server from Apache2 to nginx,how can set rewrite? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: when I change web server from Apache2 to nginx,how can set rewrite? (/showthread.php?tid=14159) |
when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 12-20-2008 [eluser]chmod[/eluser] install Ci in nginx,how to set rewrite? if in apche2,I will setup like this: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] how can i do in nginx? thanks when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 12-20-2008 [eluser]Pascal Kriete[/eluser] Does the method Popcorn describes in this post work for you? when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 12-20-2008 [eluser]chmod[/eluser] I will try it.thanks Pascal Kriete. my nginx.conf is like this: user nginx nginx; worker_processes 10; error_log logs/error.log; pid logs/nginx.pid; events { use epoll; worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; keepalive_timeout 65; gzip on; server { listen 80; root /var/www/myproject/; charset utf-8; access_log logs/host.access.log main; index index.php index.html index.htm; error_page 500 502 503 504 /50x.html; location / { if (-f $request_filename) { expires max; break; } if (!-e $request_filename) { rewrite ^(.*)$ /index.php/$1 last; } } location = /50x.html { root /var/www/; } location ~ \.php$ { fastcgi_pass 127.0.0.1:10005; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/myproject/$fastcgi_script_name/; include fastcgi_params; } location ~ /\.ht { deny all; } } } but it can't work. error log: 2008/12/21 01:07:08 [error] 4270#0: *1 rewrite or internal redirection cycle while processing "/index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//kohana/index.php/examples/calendar", client: 127.0.0.1, server: liujun-laptop, request: "GET /kohana/index.php/examples/calendar HTTP/1.1", host: "localhost", referrer: "http://localhost/" when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 01-13-2009 [eluser]Matthieu Fauveau[/eluser] Hi chmod, This is what I have done to get CodeIgniter rewriting under Nginx (of course you will have to had this inside the server { }) : Code: # rewriting for CodeIgniter You will also have to change your config.php file like this: Code: $config['uri_protocol'] = "REQUEST_URI"; That should work! when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 10-21-2009 [eluser]chmod[/eluser] [quote author="Matthieu Fauveau" date="1231902703"]Hi chmod, This is what I have done to get CodeIgniter rewriting under Nginx (of course you will have to had this inside the server { }) : Code: # rewriting for CodeIgniter You will also have to change your config.php file like this: Code: $config['uri_protocol'] = "REQUEST_URI"; That should work![/quote] it's work.but $_GET cannot used. In my project, I use $.getJSON and like dialog.js?key=random(), if I change $config['uri_protocol'] = "PATH_INFO"; TO $config['uri_protocol'] = "REQUEST_URI"; it's not work. when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 04-06-2011 [eluser]Unknown[/eluser] i have same problem.. is this post fixed? need help... thank you... when I change web server from Apache2 to nginx,how can set rewrite? - El Forum - 06-06-2011 [eluser]nil_php[/eluser] Hi friends I have same problem. I want to use PATH_INFO with nginx because my tracking url like abc.com/search?a_aid=12345 Please help us to use $config['uri_protocol'] = "PATH_INFO"; with nginx. |