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
Project ID:
98fa8794-e838-4ce7-a561-3fceba0dc77f
98fa8794-e838-4ce7-a561-3fceba0dc77f
that nginx config looks suspiciously like one that I modified for someone else in these forms that has nothing to do with laravel
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
do you need to redirect all requests to index.php
Yes, I think so, then index.php will route every request to its according function
delete your railway.json file
and then use this config file
Yes! It worked! Thank you so much for your time, finally I was able to deploy my website after so many hours
no problem!
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/
an .htaccess file is irrelevant when using an nginx server, i will have a look at your repo later
Thank you, I'll remove the .htaccess in the meantime
.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
Yep, you're right. It used to be deployed on Heroku so I needed that file there
the index.php file handles all the routing, so you have to figure out why your router is not rendering the desired routes correctly
Okay, I'll check it out. Thank you so much!