Welcome Guest, Not a member yet? Register   Sign In
codeigniter and nginx
#1

Hello all
I'm trying to move codeigniter from apache to nginx
I'm using that config https://www.nginx.com/resources/wiki/sta...deigniter/
main index.php is working for me, but other pages give me 500 error


Code:
$ curl -X POST http://somedomain.com/some/url/here -Iv
*   Trying 192.168.0.1...
* Connected to 192.168.0.1 (192.168.0.1) port 80 (#0)
> POST /player/proc/updateallcommission/ HTTP/1.1
> Host: 192.168.0.1
> User-Agent: curl/7.43.0
> Accept: */*

< HTTP/1.1 500 Internal Server Error
HTTP/1.1 500 Internal Server Error
< Server: nginx/1.9.9
Server: nginx/1.9.9
< Date: Wed, 16 Dec 2015 23:02:31 GMT
Date: Wed, 16 Dec 2015 23:02:31 GMT
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Connection: keep-alive
Connection: keep-alive
< X-Powered-By: PHP/5.6.16
X-Powered-By: PHP/5.6.16
< Cache-Control: no-cache, must-revalidate
Cache-Control: no-cache, must-revalidate
< Expires: Sat, 26 Jul 1997 05:00:00 GMT
Expires: Sat, 26 Jul 1997 05:00:00 GMT

In apache that page giving me 200 code

my current nginx config


Code:
worker_processes  1;

events {
    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;
        server_name  192.168.0.1;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location C:/Wnmp/html {
            root   html;
            index  index.html index.htm index.php;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
location ~ \.php$ {
            root           C:/Wnmp/html;
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
location / {
            try_files $uri $uri/ /index.php;
        }
    }
}

and I'm starting php-fpm with bat file

Code:
@echo off
echo Starting PHP FastCGI...
set path=C:\web\php;%PATH%
C:\web\php\php-cgi.exe -b 127.0.0.1:9123 -c C:\web\php\php.ini
Can you help me please? 
Thanks
Reply
#2

Add this to your location block:

try_files $uri $uri/ /index.php?$query_string;
Best regards,
José Postiga
Senior Backend Developer
Reply




Theme © iAndrew 2016 - Forum software by © MyBB