CodeIgniter Forums
Getting Internal Server Error when i use nginx config - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Getting Internal Server Error when i use nginx config (/showthread.php?tid=75696)



Getting Internal Server Error when i use nginx config - tweenietomatoes - 03-06-2020

I tried to use nginx config from https://codeigniter4.github.io/userguide/general/urls.html?highlight=nginx

i am getting internal server error on args.

For example www.example.com/home/test

I changed that example with 

PHP Code:
location / {
try_files $uri $uri/ /index.php$args


dropped just one / and now it's working...


RE: Getting Internal Server Error when i use nginx config - jreklund - 03-07-2020

Hi,

Thanks for the information. It's indeed incorrect in the documentation.

If I'm not mistaken you can leave $args out completely from CI4.
PHP Code:
location / {
        try_files $uri $uri/ /index.php;


If you still want $args to be passed to CI, you should make sure a ? are passed to the index.php file. With $is_args it checks if a ? are needed (if $args are not empty). So it don't append ? all the time.
PHP Code:
location / {
        try_files $uri $uri/ /index.php$is_args$args;