Codeigniter - NGINX How to Remove index.php

Viewed 236

Issue Details

Description : adding nginx custom.conf is not working for me. It is showing below error

404 Not Found
nginx/1.18.0

but if I add index.php/ before classname in URL then it works fine

Please let me know how to remove index.php from url with Elastickbeanstalk + nginx + codeigniter setup

Below mention are the full details of my application

Version

PHP 7.4
Codeignter 3.10

Deployment Setup

AWS
ElasticBeanstalk
NGINX

MY Application Setup

.platform
  -nginx
     -conf.d
        -custom.conf
-Application
-Controller
-Views
-Model
...
...
..

Custom Config custom.conf

files:
  /etc/nginx/conf.d/proxy.conf:
    mode: "000644"
    owner: root
    group: root
    content: |
      server {
        server_name http://domain.tld/;

        root /var/www;
        index index.html index.php;

        # set expiration of assets to MAX for caching
        location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
                expires max;
                log_not_found off;
        }

        location / {
                # Check if a file or directory index file exists, else route it to index.php.
                try_files $uri $uri/ /index.php;
        }

        location ~* \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                include fastcgi.conf;
        }
    }

My config.php

$config['base_url'] = "http://domain.tld/";
$config['index_page']       = "";
$config['uri_protocol']     = "REQUEST_URI";

Please help!!!

1 Answers

I solved this by entering correct path for proxy conf.

Thank you Xaver!

Related