Hi there,
I installed CI and created custom admin modules that works fine in a environment with Debian, Nginx, Apache and MySQL. Removing NGINX and running Apache on port 80 also works fine (i.e. custom controllers works fine)
However, removing Apache from the scenario and enabling NGINX with PHP-FPM (with sockets), makes the custom controllers unreachable. Meaning, with PHP-FPM, all those pages return HTTP 404 error. even though, all the rest of the website works just fine.
The only difference is PHP-FPM instead of Apache.
The custom controllers are created in different folders and the route is called "admin". It's configured within application/config/routes.php as described bellow:
$route['admin'] = 'admin/login'
Plus, the whole directory tree structure is described bellow:
ls ./application/back-modules/
dashboard event footer home login
MVC layers are organized bellow each subdirectory as in
ls ./application/back-modules/login/
controllers/ models/ views/
and so on...
Thus, there's no explicit /admin directory, neither /admin/controllers, admin/views nor admin/models
I believe the problem's related to rewrite rules, somehow. I've tried some examples from the forums, involving "rewrite rules" within NGINX configuration, but none of them worked. See bellow the latest NGINX config file that I tried (nginx/sites-enable/mysite)
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.htm index.html;
location ~* ^.+.(ico|css|js|gif|jpe?g|jpg|png|xml)$ {
expires 15d;
}
location / {
try_files $uri $uri/ /index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html/custom_50x.html;
}
location /admin {
rewrite ^/admin/login(.*)? /admin/login/index$1 last;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}