title: Nginx config for Joomla & Codeigniter inside a sub directory
body: <p>The following <code>nginx</code> configuration seems not working and returns a <code>404</code> error when accessing the <code>http://example.com/xml_apps/</code>- however the joomla website works fine from the root url <code>http://example.com</code> </p>
  
  <p><strong>UPDATE</strong>
  It looks like the requests are now sending to codeigniter app as the 404 error is coming from CI app. </p>
  
  <pre><code>http://example.com/xml_apps/index.php/xmlengine/jmprovince?category=1&amp;count=10
  </code></pre>
  
  <p>Do we need some sort of config to add for codeigniter level? to get the about controller/action working.</p>
  
  <pre><code>server {
      listen   80;
      root /home/ubuntu/websites/example.com/public_html;
      index index.html index.htm index.php;
      server_name example.com;
  location / {
      try_files $uri $uri/ /index.php;
  }
  location /xml_apps/ {
      if ($request_uri ~ "^system.*"){
          rewrite ^/xml_apps/(.*)$ /xml_apps/index.php?/$1 last;
      }
      if (!-e $request_filename){
          rewrite ^/xml_apps/(.*)$ /xml_apps/index.php?/$1 last;
      }
  }
  location ~ \.php$ {
      try_files $uri =404;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      fastcgi_hide_header X-Powered-By;
      fastcgi_param  REQUEST_URI      $request_uri;
      fastcgi_param  QUERY_STRING     $query_string;
      fastcgi_param  REQUEST_METHOD   $request_method;
      fastcgi_param  CONTENT_TYPE     $content_type;
      fastcgi_param  CONTENT_LENGTH   $content_length;
  }
  }
  </code></pre>