Recently, I configured Nginx + PHP FPM using VestaCP on my cloud server. After configuring DNS and all other basic stuff, I deployed a CodeIgniter project on my domain. Deployment was successful but whenever I tried to hit the domain it gave me 404 error. After a lot of searching I found the solution.
- Log in to your server via SSH
- Open Nginx configuration file for your domain
sudo nano /home/<username>/conf/web/<domain-address>.nginx.conf
- Add the following code in conf file
location / {
try_files $uri $uri/ /index.php; //add this line
}
- Validate configuration file by running this command
sudo nginx -t
- At the end, restart Nginx service
sudo systemctl reload nginx
You saved my day.
i cannot find this its said directery not exist