Getting 403 error after PHP app deployment

Hi everyone, I'm getting a 403 Forbidden error after deploying a PHP app, I've tried using the solutions provided on other posts but I've had no success. The error I get is [error] 23#23: *1 directory index of "/app/" is forbidden, client: 192.168.0.4, server: localhost, request: "GET / HTTP/1.1", host: "rmacias-devwebcamp.up.railway.app" 192.168.0.4 I'll leave the repo with my code: https://github.com/Rober7oMaG/DevWebCamp Thank you in advance!
GitHub
GitHub - Rober7oMaG/DevWebCamp: PHP 8 project using MVC ActiveRecor...
PHP 8 project using MVC ActiveRecord architecture. Features SASS and PayPal payments. - GitHub - Rober7oMaG/DevWebCamp: PHP 8 project using MVC ActiveRecord architecture. Features SASS and PayPal p...
17 Replies
Percy
Percy2y ago
Project ID: 98fa8794-e838-4ce7-a561-3fceba0dc77f
Rober7oMaG
Rober7oMaGOP2y ago
98fa8794-e838-4ce7-a561-3fceba0dc77f
Brody
Brody2y ago
that nginx config looks suspiciously like one that I modified for someone else in these forms that has nothing to do with laravel
Rober7oMaG
Rober7oMaGOP2y ago
Yes, I tried to follow the solutions from other posts but didn’t work out. It is pure PHP, not Laravel. My root folder was named public/ but renamed it to app/, then I added the railway.json and the nginx config file
Brody
Brody2y ago
do you need to redirect all requests to index.php
Rober7oMaG
Rober7oMaGOP2y ago
Yes, I think so, then index.php will route every request to its according function
Brody
Brody2y ago
delete your railway.json file and then use this config file
Rober7oMaG
Rober7oMaGOP2y ago
Yes! It worked! Thank you so much for your time, finally I was able to deploy my website after so many hours
Brody
Brody2y ago
no problem!
Rober7oMaG
Rober7oMaGOP2y ago
I'm having some issues with the routing, when I click one of the links on the navbar it correctly shows the route on the browser but it keeps rendering the home page. I'm not sure if it's something on the nginx.template.conf or the .htaccess file. The deployed app url is: https://rmacias-devwebcamp.up.railway.app/
Brody
Brody2y ago
an .htaccess file is irrelevant when using an nginx server, i will have a look at your repo later
Rober7oMaG
Rober7oMaGOP2y ago
Thank you, I'll remove the .htaccess in the meantime
Brody
Brody2y ago
.htaccess is an apache thing, and you have set your .htaccess up to redirect all requests to index.php, and i have set up the nginx config to do the exact same thing
Rober7oMaG
Rober7oMaGOP2y ago
Yep, you're right. It used to be deployed on Heroku so I needed that file there
Brody
Brody2y ago
the index.php file handles all the routing, so you have to figure out why your router is not rendering the desired routes correctly
Rober7oMaG
Rober7oMaGOP2y ago
Okay, I'll check it out. Thank you so much!
Want results from more Discord servers?
Add your server