Welcome Guest, Not a member yet? Register   Sign In
404 Not found with a sub-directory installation on nginx
#1
Question 

Hello,

you might notice I asked this question on StackOverflow as well. I'am really in a hurry to get a response.

A website - let's call it fru.it - servers a CodeIgniter application under fru.it/blueberry trough nginx and PHP-FPM. The main site resides in /var/www/fru.it/ on the filesystem, while the app is under /var/www/fru.it_blueberry/blueberry/ (different root than the main site). In an attempt to tighten security while CodeIgniter was upgraded to 3.1.0, the app's file structure was changed as per the CodeIgniter User Manual to:
Code:
/var/www/fru.it_blueberry/
├── blueberry
│   ├── application
│   ├── docs
│   ├── public
│   │   ├── index.php
│   └── system
└── sock
On development machines the setup works fine with Apache2's default mod_rewrite rules shipped with CI. Accessing fru.it/blueberry/ on the production server, however, displays a CI 404 page. 
I'm sure it's a misconfiguration but I can't find the right detail by myself and have been trying with different setups. What do I need to change?

Application Configuration
The index file is modified to point to absoulte paths of diretories that got moved out of the public root:
Code:
$system_path = '/var/www/radiostudent.si_klubskimaraton/klubskimaraton/system'
$application_folder = '/var/www/radiostudent.si_klubskimaraton/klubskimaraton/application';
This is from application/config/config.php:
Code:
$config['base_url'] = '';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
$config['log_threshold'] = 4;
In application/config/routes.php, a default controller is set to display the homepage at the bare address:
Code:
$route['default_controller'] = "Welcome";
$route['404_override'] = '';

Application Log
Code:
INFO - 2016-09-02 12:16:19 --> Config Class Initialized
INFO - 2016-09-02 12:16:19 --> Hooks Class Initialized
DEBUG - 2016-09-02 12:16:19 --> UTF-8 Support Enabled
INFO - 2016-09-02 12:16:19 --> Utf8 Class Initialized
INFO - 2016-09-02 12:16:19 --> URI Class Initialized
INFO - 2016-09-02 12:16:19 --> Router Class Initialized
INFO - 2016-09-02 12:16:19 --> Output Class Initialized
INFO - 2016-09-02 12:16:19 --> Security Class Initialized
DEBUG - 2016-09-02 12:16:19 --> Global POST, GET and COOKIE data sanitized
INFO - 2016-09-02 12:16:19 --> Input Class Initialized
INFO - 2016-09-02 12:16:19 --> Language Class Initialized
ERROR - 2016-09-02 12:16:19 --> 404 Page Not Found: /index

Webserver Configuration
Code:
location /blueberry {
   error_log /var/www/radiostudent.si_klubskimaraton/main-error.log debug;
   rewrite_log on;
   alias   /var/www/fru.it_blueberry/blueberry/public;
   index   index.html index.htm index.php;
   try_files $uri $uri/ /index.php;

   location ~* \.php$ {
           error_log /var/www/radiostudent.si_klubskimaraton/php-error.log debug;
           rewrite_log on;
           try_files $uri $uri/ /index.php =404;
           fastcgi_split_path_info ^(.+\.php)(/.+)$;
           include fastcgi_params;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME $request_filename;
           fastcgi_pass @php-blueberry;

   }
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB