Welcome Guest, Not a member yet? Register   Sign In
can i use codeigniter with nginx?
#1

I am not using apache on my server. Is it possible to use codeigniter with nginx?

Thanks
Reply
#2

(11-11-2014, 01:34 AM)agriz Wrote: I am not using apache on my server. Is it possible to use codeigniter with nginx?

Thanks

Yep Sure!

Works like a charm!

Any help setting up let me know?

Cheers.
Reply
#3

Sure you can, i've been using it like that on tons of projects.
Website: marcomonteiro.net  | Blog: blog.marcomonteiro.net | Twitter: @marcogmonteiro | TILThings: tilthings.com
Reply
#4

ci can be used on all major server an os because its a non exotic php framework ;o)

Reply
#5

Yes, you can use CI over nginx (Engine X). CI is basically a PHP based framework. So, you need a web server to handle your request and responses and run your codes. A web server may be apache, nginx, IIS or PHP inbuilt web server.

If you want to install and setup nginx on Ubuntu. You can refer to http://getweblessons.com/install-configu...ntu-14-04/.

Let me know if you need any more help.

Nitin
Reply
#6

(11-11-2014, 01:34 AM)agriz Wrote: I am not using apache on my server. Is it possible to use codeigniter with nginx?

Thanks

Hello,

that is the same question that i was wondering one year ago.

O yeah yes you can and very easily Wink

This is part of my configuration for CI on nginx

PHP Code:
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
 
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;

Reply
#7

Ok you guys,

As there are some nginx experts in here... Maybe one of you can be of assistance.

I'm trying to figure out for some time to get a CI project working on a new server running nginx.
I have tried a couple of things but nothing seems to work. Apache was never a problem, but because I am a complete newby on nginx configuration I can't get things to work.

My standard nginx config is the following:

Code:
server {
    listen      my.servers.ip.address:80;
    server_name domain.nl www.domain.nl;
    error_log  /var/log/httpd/domains/domain.nl.error.log error;

    location / {
        proxy_pass      http://128.199.58.148:8080;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
            root           /home/my_user/web/domain.nl/public_html;
            access_log     /var/log/httpd/domains/domain.nl.log combined;
            access_log     /var/log/httpd/domains/domain.nl.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/my_user/web/domain.nl/document_errors/;
    }

    location @fallback {
        proxy_pass      http://my.servers.ip.address:8080;
    }

    location ~ /\.ht    {deny all;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

}

How can I change things so that stuff like rewriting etc. works..?

I found this article about a nginx config with a very rich featured config I really want to use:
http://www.farinspace.com/codeigniter-ng...ite-rules/

Does anyone know how I can change my config and add the cool features from the article above?

Thanks in advance,

-Roger
Reply
#8

hey there
might be an overdue answer , thou this Que. has been bugging me for a day
best link to check out is https://gist.github.com/yidas/30a6114499...7951e5f17f

my config
first thing is first dont forget to backup ur config + change .htaccess file like
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

on CodeIgniter side application/config/config.php
$config['base_url'] = '';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'REQUEST_URI';

on Nginx side
server_name domainname.ts;
server_name 192.168.0.7; // local ip address
listen 127.0.0.1:80;
listen *:80;
location ~* \.php$ {
fastcgi_pass php_farm;
include nginx.fastcgi.conf;
}

location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}

# Deny for accessing .htaccess files for Nginx
location ~ /\.ht {
deny all;
}
#hope this works for future request,
Reply




Theme © iAndrew 2016 - Forum software by © MyBB