Welcome Guest, Not a member yet? Register   Sign In
routes working only in local
#5

(This post was last modified: 06-10-2015, 03:32 PM by CroNiX.)

Codeigniter has nothing to do with the server it's being run on. The server, whether it's Apache, NGINX, LightHTTP, IIS or something else it needs to be set up to run the PHP application, whether it's CI or WordPress or something else. The application can't alter to webserver to "make itself run". No webserver runs PHP by default, except maybe PHP's built-in webserver.

Here's a working NGINX conf for a CI site:
Code:
server {
    listen 80;

    server_name YOUR_SERVER.com ;
    root /var/www/PATH_TO_SITE_ROOT;

    error_page 404 403 /404.html;

    location / {
        index index.html index.php; ## Allow a static html file to be shown first
        try_files $uri $uri/ @handler;
        expires 30d; ## Assume all files are cachable
    }

    ## These locations would be hidden by .htaccess normally
    location ^~ /application/        { deny all; }

    location  /. { ## Disable .htaccess and other hidden files
        return 404;
    }

    location @handler {
        rewrite / /index.php;
    }

    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
        rewrite ^(.*.php)/ $1 last;
    }

    location ~ .php$ { ## Execute PHP scripts
        if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss

        expires        off; ## Do not cache dynamic content
        fastcgi_param  HTTPS $fastcgi_https;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SITE_ENVIRONMENT development;
        fastcgi_pass   unix:/tmp/php-fpm.sock;
        include        fastcgi_params; ## See /etc/nginx/fastcgi_params
    }
}

The main things you would need to change with your values are:
Code:
server_name YOUR_SERVER.com ;
root /var/www/PATH_TO_SITE_ROOT;

and to set the site environment:
Code:
fastcgi_param  SITE_ENVIRONMENT development;
Reply


Messages In This Thread
routes working only in local - by StratoKyke - 06-10-2015, 10:32 AM
RE: routes working only in local - by StratoKyke - 06-10-2015, 12:42 PM
RE: routes working only in local - by RogerMore - 06-10-2015, 01:21 PM
RE: routes working only in local - by StratoKyke - 06-10-2015, 02:40 PM
RE: routes working only in local - by CroNiX - 06-10-2015, 03:31 PM
RE: routes working only in local - by StratoKyke - 06-10-2015, 03:51 PM
RE: routes working only in local - by StratoKyke - 06-12-2015, 04:32 AM
RE: routes working only in local - by CroNiX - 06-10-2015, 04:52 PM
RE: routes working only in local - by StratoKyke - 06-10-2015, 11:54 PM
RE: routes working only in local - by StratoKyke - 06-11-2015, 01:03 AM
RE: routes working only in local - by StratoKyke - 06-11-2015, 12:47 PM
RE: routes working only in local - by StratoKyke - 06-12-2015, 12:38 AM
RE: routes working only in local - by StratoKyke - 06-12-2015, 02:03 PM
RE: routes working only in local - by John_Betong - 06-12-2015, 06:40 PM
RE: routes working only in local - by StratoKyke - 06-12-2015, 09:57 PM
RE: routes working only in local - by StratoKyke - 06-13-2015, 08:53 AM
RE: routes working only in local - by StratoKyke - 06-13-2015, 10:02 AM
RE: routes working only in local - by StratoKyke - 06-13-2015, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB