403 Error everywhere except index
July 02, 2016 02:36PM
Hello. I'm new to NGINX and recently switch from Apache2. I am using the same folders from Apache with my new NGINX installation. Everything has worked fine except that I can only access the website index. Any other directory on my server I cannot access without getting a 403 error. I've looked online for some help, but couldn't find anything that worked. Any ideas?
Re: 403 Error everywhere except index
July 02, 2016 02:55PM
https://forum.nginx.org/read.php?1,252530

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: 403 Error everywhere except index
July 02, 2016 05:27PM
Sorry about that. Very new to this forum and didn't know.

Config:

http://pastebin.com/KiKgNbEJ

Error log:

http://pastebin.com/ztCfamcj
Re: 403 Error everywhere except index
July 02, 2016 05:35PM
From that paste you have no server {} block or location {} block, you need at least one of each.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: 403 Error everywhere except index
July 02, 2016 06:09PM
I added this to the config...

http {
index index.html;

server {
server_name 91.121.223.206;
access_log logs/site.access.log main;

root /var/www/html/public_html;
}
}

But I end up getting an error

https://gyazo.com/7ff57f456c968aa6cb3c296f37970122
Re: 403 Error everywhere except index
July 02, 2016 06:26PM
When I pasted the config onto here, it removed all formatting. Here is a pastebin of the full config. http://pastebin.com/pae4Yt7W
Re: 403 Error everywhere except index
July 02, 2016 07:18PM
worker_processes 2;

error_log logs/error.log;

events {
worker_connections 16384;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile off;
server_names_hash_bucket_size 128;
map_hash_bucket_size 64;
access_log logs/access.log;
tcp_nodelay on;

server {
listen 80;
server_name 91.121.223.206;
access_log logs/site.access.log main;
root /var/www/html/public_html;
location / {
try_files $uri $uri/ =404;
index index.html index.htm;
}
}

}

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: 403 Error everywhere except index
July 02, 2016 08:07PM
Didn't seem to work when I added it to the config. I believe it's because the website skips spaces when pasting things in. Do you mind uploading that to something like pastebin so the formatting is correct? Thanks for helping me by the way :)
Re: 403 Error everywhere except index
July 04, 2016 03:19AM
I messed with the config a little bit, and got this.
http://pastebin.com/gdx9bDrA

If that isn't correct, let me know. If it is, then I'm still having a problem. Anywhere I try to go besides my index, it will give me the 403 error.
Re: 403 Error everywhere except index
July 04, 2016 12:43PM
What is in '/var/www/html/public_html' ?
Check the logfiles to see what your asking for and what nginx writes in the log about it.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 83
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready