mysql - Nginx CodeIgniter not working -
i new nginx. transfering server apache nginx many projects on codeigniter core php sites working codeigniter not work.
my sample url this:
http://example.com/track/
this redirect to:
http://example.com/track/index.php/sessions/login
but returns 404 not found.
my server configure this:
server { listen 80; server_name 192.168.0.80; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } #error_page 404 /404.html; # redirect server error pages static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # pass php scripts fastcgi server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } # deny access .htaccess files, if apache's document root # concurs nginx's 1 # location ~ /\.ht { deny all; } }
my error log file this
2013/05/15 10:21:37 [error] 2474#0: *3 open() "/usr/share/nginx/html/favicon.ico" failed (2: no such file or directory), client: 192.168.0.11, server: 192.168.0.80, request: "get /favicon.ico http/1.1", host: "192.168.0.80" 2013/05/15 10:21:37 [error] 2474#0: *1 fastcgi sent in stderr: "unable open primary script: /usr/share/nginx/html/index.php (no such file or directory)" while reading response header upstream, client: 192.168.0.11, server: 192.168.0.80, request: "get /index.php http/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.0.80" 2013/05/15 10:22:05 [error] 2474#0: *1 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: not directory), client: 192.168.0.11, server: 192.168.0.80, request: "get /track/index.php/sessions/login http/1.1", host: "192.168.0.80" 2013/05/15 10:26:46 [error] 2474#0: *5 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: not directory), client: 192.168.0.11, server: 192.168.0.80, request: "get /track/index.php/sessions/login http/1.1", host: "192.168.0.80" 2013/05/15 10:28:33 [error] 2474#0: *7 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: not directory), client: 192.168.0.11, server: 192.168.0.80, request: "get /track/index.php/sessions/login http/1.1", host: "192.168.0.80" 2013/05/15 10:29:59 [error] 2497#0: *1 open() "/usr/share/nginx/html/track/index.php/sessions/login" failed (20: not directory), client: 192.168.0.11, server: 192.168.0.80, request: "get /track/index.php/sessions/login http/1.1", host: "192.168.0.80"
what's wrong? did search in google not working perfectly.
check out link, should fix rewriting issues.
if have further questions can ask.
code igniter nginx
edit:
ok there's several ways fix case, i'll describe closest case
if you're going edit in same file nginx conf how think you're doing right try adding this
location /track { try_files $uri $uri/ /track/index.php; }
not sure if routing needs $request_uri
appended index.php
or not. , think should configure codeigniter aware of sub folder
$config['base_url'] = "192.168.0.80/track"
this isn't cleanest way configuration, i'd prefer adding domain name in /etc/hosts
, create new separate server in nginx.
Comments
Post a Comment