Welcome Guest, Not a member yet? Register   Sign In
Nginx configuration with and without subdirectory
#1
Question 

Is there an nginx configuration equivalent of the supplied .htaccess file for CI4?

i.e. one that shows how to serve a CI4 application from a "root" URL and from a sub-directory URL.

-joho
Reply
#2

See https://codeigniter4.github.io/CodeIgnit...with-nginx
Reply
#3

(09-13-2023, 01:05 AM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...with-nginx

Thank you. I have something similar. But for sub-directories, it got a little bit trickier.

So what I'm currently using is something like:


Code:
location ^~ /subdirectory {
    alias /var/www/subdirectory/public_html/public;
    index index.php;
    try_files $uri $uri/ @my_subdirectory;

    location ~ [^/]\.php(/|$) {
        fastcgi_pass 127.0.0.1:8002;
        fastcgi_index index.php;
    } 
}

location @my_subdirectory {
    rewrite /subdirectory/(.*)$ /subdirectory/index.php?/$1 last;
}


But I don't know if there's a better way of doing it.

-joho
Reply




Theme © iAndrew 2016 - Forum software by © MyBB