CodeIgniter Forums
Nginx config - 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: Nginx config (/showthread.php?tid=53635)



Nginx config - El Forum - 08-01-2012

[eluser]kezman[/eluser]
Hey everyone!
I have Apache on my local site.
I have Nginx on my live site.

I have Apache .htaccess

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|css|images|robots\.txt|css)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

How should I configure nginx?

Now my live site works only for http://example.com/.
Other URLs like http://example.com/abc/def/1 produce "nginx - not found" error.


Nginx config - El Forum - 08-01-2012

[eluser]CroNiX[/eluser]
Did you create a config file for nginx for your project? If you google "nginx+codeigniter" you will find some to try out.


Nginx config - El Forum - 08-01-2012

[eluser]Abel A.[/eluser]
Here's my nginx config

Code:
server {
    server_name mysite.com www.mysite.com;
    root /home/abel/public_html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php;
    }

    include php;
    access_log off;
}

The CI stuff is just in the location segment, the rest is standard.