Question

403 Error after Initial Server Setup and Nginx Implementation

Posted January 21, 2020 151 views
NginxServer OptimizationInitial Server Setup

My website ‘alexanderhorvath.com’ is displaying a '403 Forbidden’ error when searching its address.

I think the problem is with the configuration file (located in root/var/ww)

Or, my private key is inaccessible to to the public

I followed the Digital Ocean guides on initial server setup, haphazardly so, until I found my domain located on check-host.net

I followed this Medium guide for implementing Nginx : https://medium.com/@jgefroh/a-guide-to-using-nginx-for-static-websites-d96a9d034940

More details can be provided, just let me know

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @ajhorvath36,

It seems like your Nginx configuration file is not serving the proper files or it’s not seeing the document root folder. DigitalOcean has a pretty good tutorial on that matter here - https://www.digitalocean.com/community/tutorials/understanding-the-nginx-configuration-file-structure-and-configuration-contexts

Having said that, here are a few suggestions you might check

Index Files

One of the most common causes of the “403 Forbidden” error is not having a correctly set up index file.

The NGINX configuration file specifies which index files to load, and in which order. For example, this line tells NGINX to look for index.html, then index.htm, then index.php:

index index.html index.htm index.php;mixed

If none of those three files are found in the directory, NGINX returns a “403 Forbidden” error.

File Permissions

Incorrect file permissions are another cause of the “403 Forbidden” error. The standard setting of 755 for directories and 644 for files is recommended for use with NGINX. The NGINX user also needs to be the owner of the files.

Additionally, if you are unable to resolve it, please pass your Nginx Configuration and I’ll be able to further help you out.

Regards,
KDSys

by Justin Ellingwood
Nginx is one of the most popular web servers in the world, focused on performance and scalability. In this guide, we will explore the Nginx configuration file structure and discuss the configuration "contexts" that Nginx uses to logically separate different configuration values.
Submit an Answer