<?xml version="1.0" encoding="utf-8"?>
<!-- If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/ -->
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:lj="http://www.livejournal.com">
  <id>urn:lj:livejournal.com:atom1:crazy_lionheart</id>
  <title>Записки безумца</title>
  <subtitle>О чём думаю, о том и пою</subtitle>
  <author>
    <name>El Romantico Revolucionario</name>
  </author>
  <link rel="alternate" type="text/html" href="http://crazy-lionheart.livejournal.com/"/>
  <link rel="self" type="text/xml" href="http://crazy-lionheart.livejournal.com/data/atom"/>
  <updated>2038-01-19T03:14:07Z</updated>
  <lj:journal userid="10500085" username="crazy_lionheart" type="personal"/>
  <link rel="service.feed" type="application/x.atom+xml" href="http://crazy-lionheart.livejournal.com/data/atom" title="Записки безумца"/>
  <link rel="hub" href="http://pubsubhubbub.appspot.com/"/>
  <entry>
    <id>urn:lj:livejournal.com:atom1:crazy_lionheart:296547</id>
    <link rel="alternate" type="text/html" href="http://crazy-lionheart.livejournal.com/296547.html"/>
    <link rel="self" type="text/xml" href="http://crazy-lionheart.livejournal.com/data/atom/?itemid=296547"/>
    <title>Мы ему але гоп, а оно нам  - вуаля</title>
    <published>2038-01-19T03:14:07Z</published>
    <updated>2038-01-19T03:14:07Z</updated>
    <category term="codeigniter"/>
    <category term="работа"/>
    <category term="nginx"/>
    <content type="html">Перевёл рабочий сайт на nginx. Не без проблем, конечно, но все они уже позади. Итак:&lt;ol&gt;&lt;li&gt;Сначала допиливаем URI класс, ибо к нам приходят GET-параметры. Я их в не использую, хотя модификация позволяет&lt;br /&gt;&lt;a name="cutid1"&gt;&lt;/a&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;
### MY_URI.php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class MY_URI extends CI_URI {
  
  var $_get_params = array();

  function _fetch_uri_string() {
    
    parse_str($_SERVER['QUERY_STRING'], $this-&amp;gt;_get_params);
       
    $_GET = array();
    $_SERVER['QUERY_STRING'] = ''; 
    
    parent::_fetch_uri_string();  

  }
  
  function getParam($key) {
    if (isset($this-&amp;gt;_get_params[$key])) {
      return $this-&amp;gt;_get_params[$key];
    } else {
      return false;
    }
  }
  
  function getParams() {
    return $this-&amp;gt;_get_params;
  }
  
  function _parse_request_uri()
	{
		if ( ! isset($_SERVER['REQUEST_URI']) OR $_SERVER['REQUEST_URI'] == '')
		{
			return '';
		}

		$request_uri = preg_replace(&amp;quot;|/(.*)|&amp;quot;, &amp;quot;\\1&amp;quot;, str_replace(&amp;quot;\\&amp;quot;, &amp;quot;/&amp;quot;, $_SERVER['REQUEST_URI']));

		if ($request_uri == '' OR $request_uri == SELF)
		{
			return '';
		}
		$start = strpos($request_uri, '?');
		$end = strpos($request_uri, '#');
		if ($start !== FALSE &amp;amp;&amp;amp; $end === FALSE)
		{
		    $request_uri = substr($request_uri, 0, $start);
		}
		elseif ($start !== FALSE &amp;amp;&amp;amp; $end !== FALSE)
		{
		    $tmp = substr($request_uri, 0, $start);
		    $tmp .= substr($request_uri, $end);
		    $request_uri = $tmp;
		}
		    

		$fc_path = FCPATH.SELF;
		if (strpos($request_uri, '?') !== FALSE)
		{
			$fc_path .= '?';
		}

		$parsed_uri = explode(&amp;quot;/&amp;quot;, $request_uri);

		$i = 0;
		foreach(explode(&amp;quot;/&amp;quot;, $fc_path) as $segment)
		{
			if (isset($parsed_uri[$i]) &amp;amp;&amp;amp; $segment == $parsed_uri[$i])
			{
				$i++;
			}
		}

		$parsed_uri = implode(&amp;quot;/&amp;quot;, array_slice($parsed_uri, $i));

		if ($parsed_uri != '')
		{
			$parsed_uri = '/'.$parsed_uri;
		}

		return $parsed_uri;
	}

} &lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Далее пилим конфиги нгникса:&lt;br /&gt;&lt;a name="cutid2"&gt;&lt;/a&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;
location = / { rewrite ^ /index.php/ last; }
	location / {
		try_files $uri /index.php$uri;
		root /path/to/static;
		expires 6h;
		access_log off;
	}
	location /index.php {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_read_timeout 180;
		fastcgi_ignore_client_abort on;
		fastcgi_index  index.php;
		fastcgi_buffers 300 5K;
	        include	fastcgi_params;
	}
&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;в fastcgi_param незабываем добавить &lt;code&gt;fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;&lt;/code&gt; &lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;CI работает через REQUEST_URI, параметры GET мы обрезаем в MY_URI, и на выходе получаем /controller/function/value/value</content>
  </entry>
</feed>
