403 Error when trying to access Grav admin on local test server


#1

I am running Nginx and PHP on Windows 10. When I access 127.0.0.1 or 127.0.0.1/info.php, I get the Nginx welcome screen and PHP output, respectively, so it seems the system on which I am trying to run Grav-admin is working. This is just for a local testing environment, this is not being served publicly on the web. I am not using WAMP or any third party server administration, I just have PHP and NginX installed manually.

I was actually able to run Grav admin one time successfully. I created an account, logged in, and browsed some themes. I thought everything was set up perfectly. I did not make any changes or adjustments, I just clicked around to explore the interface.

However, that was Friday. I shut down the computer over the weekend, came back Monday, and now when I open 127.0.0.1/grav/index.php, I get a 403 Forbidden error. The rest of the system, the NginX and PHP, appear to be working as they did before. I don’t think I changed anything, but it would appear that most likely something about rebooting the system has affected Grav’s access rights or something.

How do I resolve this error so that I can once again open up the Grav admin interface?


#2

Can you paste your nginx config? Is that the one shipped with Grav? Did you edit it? It should be

location / {
    try_files $uri $uri/ /index.php?_url=$uri&$query_string;
}

(reference: https://github.com/gantry/gantry5/issues/1748)

Try accessing 127.0.0.1/grav/, not 127.0.0.1/grav/index.php, something changes?

For reference here is a good list of common 403 nginx causes: https://www.1and1.com/cloud-community/learn/web-server/nginx/solve-an-nginx-403-forbidden-error/


#3

Thanks for responding.

I put my Nginx conf file here on Pastebin.

I did edit it somewhat following advice of some different online tutorials, but I would not be able to separate out which changes came from which source, or which problem they were trying to solve.


#4

My suggestion is to get things working with a simple configuration (like the one we include as webserver-config/nginx.conf in the Grav package. After it’s working with that then feel free to ‘slowly’ enhance it to your needs.


#5

Rhuk, thank you for responding.

Please note, it was never my intention to implement new features. The nginx.conf file I have was the result of simply trying to get NginX to work in the first place.

I’m not sure where you mean when you say there is a usable conf file in webserver-config/nginx.conf. Where exactly do I find that?


#6

Actually these webserver configuration files are in a folder in the Grav installation: https://github.com/getgrav/grav/tree/develop/webserver-configs


#7

Thank you for responding. I reviewed the supplied configuration files, and using that as a reference, I discovered that if I removed the line root html; from my Nginx conf file, then Grav seems to work.

Thanks to everyone for their support.