SlideShare a Scribd company logo
FIXING 403 FORBIDDEN NGINX ERRORS
• HTTP errors are pesky and typically hard to resolve without the right tools.
• However, with proper investigation and tools, you can easily identify the source of a problem and fix it just as fast.
• In order to debug or fix 403 Forbidden Nginx errors, all you have to do is check the correct error logs and take the proper
action to resolve it.
• We’ll go over how to check the error logs and the possible scenarios that typically cause these errors.
FIXING 403 FORBIDDEN NGINX ERRORS
Finding Error Logs
• If you know exactly where the error logs of your Nginx server are, you can skip onto the next section.
• If you’re not sure where to find the error logs of your Nginx server, then be sure to continue this section.
• The path for error logs can change a lot depending on how Nginx was installed on the server and the Linux distribution.
• If you do not know where your error logs are and you have a hard time going through Nginx configuration, we can use a very
small and useful Linux tool with the name of lsof which gives us all the open files associated to a specific process.
• This will help us find the error log for your web server.
FIXING 403 FORBIDDEN NGINX ERRORS
• The first step of this is to check for the process ID of the main Nginx process, you can run the following command and
except output somewhat similar to the one indicated below:
$ ps x | grep nginx
29229 ? S 0:00 nginx: master process /usr/sbin/nginx
• The first column of each row is the process ID, as we can see, the main/master process ID is 29229 in this case, however
this will change in every system.
• Once you have the process ID, you will be able to use the lsof too to get all open files associated to this process by
running the following.
• We’ve trimmed the output to the part you should be looking for, as there might be a lot more data when you run that
command:
FIXING 403 FORBIDDEN NGINX ERRORS
• As you can see from the above output, we can see that one of the files that are open by this Nginx installation
is /var/log/nginx/error.log which (by the file name) does look like an error log.
• We’ve now identified the path of our Nginx error log and we can move onto finding the reason behind our pesky HTTP
error.
FIXING 403 FORBIDDEN NGINX ERRORS
Fixing Nginx HTTP errors
• Once you have the correct error log file, it’s time to watch for errors.
• In our experience, the best way to do this is by running a continuous stream of the error log in your shell screen using
the tail utility.
$ tail -f /var/log/nginx/error.log
• Once you’ve ran this command, tail will continuously output any newly appended content to the error.log as it comes in until you
hit Control + C.
• We recommend that you clear the entire shell screen to make it easy to identify newly appended content.
• You can do this in Windows (PuTTY) by right clicking the PuTTY menu bar and clicking on “Clear Scrollback” or on Mac OS X by
clicking Command + K.
FIXING 403 FORBIDDEN NGINX ERRORS
• Now, you will need to replicate the issue that you are getting.
• The error should be printed out right away after you replicate the issue.
• For example, if you have a 403 Forbidden error, then you should refresh the page that is causing the problem so that a
new error log entry can be appended.
• Once that is done, you’ll see a new line in the error log which should hopefully lead you to the right path to fixing the
issue.
• We’re going to cover a few of the most common issues below.
FIXING 403 FORBIDDEN NGINX ERRORS
Incorrect Directory Settings
• The error below can be caused by two different reasons: incorrect directory index or disallowed directory listing.
2013/08/31 15:03:43 [error] 29231#0: *2098806 directory index of "/usr/share/nginx/static/" is
forbidden, client: 1.1.1.1, server: domain.com, request: "GET / HTTP/1.1", host: "domain.com”
• If you are trying to list all the files in a folder, you will get that error if the directory does not have directory listing enabled.
• You can enable directory listing by adding the following line to your Nginx configuration, you can read more about this
option here: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html
autoindex on;
FIXING 403 FORBIDDEN NGINX ERRORS
• The other possibility for that error to come up is if your index setting is incorrect, so for example, you have a index.php
file in that folder, however, your index setting is setup to index.htm and index.html.
• This means that only these files are checked if no specific file is provided.
• If you alter it to something like the following, your index.php file should work:
index index.htm index.html index.php;
FIXING 403 FORBIDDEN NGINX ERRORS
Incorrect Permissions
• The error below is generally caused by incorrect Unix permissions, you will need to make sure you have the correct permissions
for the entire path.
2013/09/01 00:31:57 [error] 29231#0: *2115270 open() "/usr/share/nginx/static/forbidden" failed (13:
Permission denied), client: 1.1.1.1, server: domain.com, request: "GET /forbidden HTTP/1.1", host: "domain.com”
• As you see, the file that we are trying to access is /usr/share/nginx/static/forbidden.
• In order for Nginx to access it with no problems at all, Nginx must have read permissions for that specific file as well as execute
for all the folders above it.
• This means that /, /usr, /usr/share, /usr/share/nginx and /usr/share/nginx/static must be executable
by Nginx and the file /usr/share/nginx/static/forbidden must be readable by Nginx in this case.
FIXING 403 FORBIDDEN NGINX ERRORS
Conclusion
• We’ve gone through quite a few tools such as tail and lsof.
• These are just one of the tools which are offered by Linux which allow system administrators to resolve and debug issues
much faster and easier.
• The most important factor in resolving system issues is being able to identify the issue properly, resolution is usually the
easiest part once the problem is identified.
• The larger the toolset of the system administrator, the faster they can identify and fix those problems.

More Related Content

What's hot

Caching web contents in the browser
Caching web contents in the browserCaching web contents in the browser
Caching web contents in the browser
Ignacio Coloma
 
2010 za con_jameel_haffejee
2010 za con_jameel_haffejee2010 za con_jameel_haffejee
2010 za con_jameel_haffejee
Johan Klerk
 
Open web mail setup
Open web mail setupOpen web mail setup
Open web mail setup
Chacheng Oo
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
RootGate
 
Incorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>AttackIncorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>Attack
jaredhaight
 
X-Debug in Php Storm
X-Debug in Php StormX-Debug in Php Storm
X-Debug in Php Storm
KLabCyscorpions-TechBlog
 
LCA2014 - Introduction to Go
LCA2014 - Introduction to GoLCA2014 - Introduction to Go
LCA2014 - Introduction to Go
dreamwidth
 
Recon
ReconRecon
How To Install Apache, MySQL & PHP on Windows Vista
How To Install Apache, MySQL & PHP on Windows VistaHow To Install Apache, MySQL & PHP on Windows Vista
How To Install Apache, MySQL & PHP on Windows Vista
Mochamad Yusuf
 
Aws amazon ec2
Aws amazon ec2Aws amazon ec2
Aws amazon ec2
Sentinel Solutions Ltd
 
Xdebug, KCacheGrind and Webgrind with WampServer
Xdebug, KCacheGrind and Webgrind with WampServer  Xdebug, KCacheGrind and Webgrind with WampServer
Xdebug, KCacheGrind and Webgrind with WampServer
Mediovski Technology
 
How to install a wordpress theme in local computer
How to install a wordpress theme in local computerHow to install a wordpress theme in local computer
How to install a wordpress theme in local computer
Digital Ideaz
 
Cloudera amazon-ec2
Cloudera amazon-ec2Cloudera amazon-ec2
Cloudera amazon-ec2
Randy Zwitch
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Registry hacks speed_up_xp
Registry hacks speed_up_xpRegistry hacks speed_up_xp
Registry hacks speed_up_xp
opptecnologia
 
Rhel5
Rhel5Rhel5
Squidinstallation
SquidinstallationSquidinstallation
Squidinstallation
Chirag Gupta
 
Upptäcka intrång med hjälp av loggning
Upptäcka intrång med hjälp av loggningUpptäcka intrång med hjälp av loggning
Upptäcka intrång med hjälp av loggning
Jonas Lejon
 
maXbox Starter 42 Multiprocessing Programming
maXbox Starter 42 Multiprocessing Programming maXbox Starter 42 Multiprocessing Programming
maXbox Starter 42 Multiprocessing Programming
Max Kleiner
 
Making the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocolMaking the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocol
Armenuhi Abramyan
 

What's hot (20)

Caching web contents in the browser
Caching web contents in the browserCaching web contents in the browser
Caching web contents in the browser
 
2010 za con_jameel_haffejee
2010 za con_jameel_haffejee2010 za con_jameel_haffejee
2010 za con_jameel_haffejee
 
Open web mail setup
Open web mail setupOpen web mail setup
Open web mail setup
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Incorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>AttackIncorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>Attack
 
X-Debug in Php Storm
X-Debug in Php StormX-Debug in Php Storm
X-Debug in Php Storm
 
LCA2014 - Introduction to Go
LCA2014 - Introduction to GoLCA2014 - Introduction to Go
LCA2014 - Introduction to Go
 
Recon
ReconRecon
Recon
 
How To Install Apache, MySQL & PHP on Windows Vista
How To Install Apache, MySQL & PHP on Windows VistaHow To Install Apache, MySQL & PHP on Windows Vista
How To Install Apache, MySQL & PHP on Windows Vista
 
Aws amazon ec2
Aws amazon ec2Aws amazon ec2
Aws amazon ec2
 
Xdebug, KCacheGrind and Webgrind with WampServer
Xdebug, KCacheGrind and Webgrind with WampServer  Xdebug, KCacheGrind and Webgrind with WampServer
Xdebug, KCacheGrind and Webgrind with WampServer
 
How to install a wordpress theme in local computer
How to install a wordpress theme in local computerHow to install a wordpress theme in local computer
How to install a wordpress theme in local computer
 
Cloudera amazon-ec2
Cloudera amazon-ec2Cloudera amazon-ec2
Cloudera amazon-ec2
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
Registry hacks speed_up_xp
Registry hacks speed_up_xpRegistry hacks speed_up_xp
Registry hacks speed_up_xp
 
Rhel5
Rhel5Rhel5
Rhel5
 
Squidinstallation
SquidinstallationSquidinstallation
Squidinstallation
 
Upptäcka intrång med hjälp av loggning
Upptäcka intrång med hjälp av loggningUpptäcka intrång med hjälp av loggning
Upptäcka intrång med hjälp av loggning
 
maXbox Starter 42 Multiprocessing Programming
maXbox Starter 42 Multiprocessing Programming maXbox Starter 42 Multiprocessing Programming
maXbox Starter 42 Multiprocessing Programming
 
Making the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocolMaking the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocol
 

Similar to Fixing 403 Forbidden Nginx Errors

Updating Neos – Why, When and How - 2024 edition
Updating Neos – Why, When and How - 2024 editionUpdating Neos – Why, When and How - 2024 edition
Updating Neos – Why, When and How - 2024 edition
Karsten Dambekalns
 
Snort ppt
Snort pptSnort ppt
Snort ppt
aAlcantar93
 
Keeping Your Joomla! Site Secure
Keeping Your Joomla! Site SecureKeeping Your Joomla! Site Secure
Keeping Your Joomla! Site Secure
joomladayhouston
 
Apache logs monitoring
Apache logs monitoringApache logs monitoring
Apache logs monitoring
Umair Amjad
 
Installing Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for WindowsInstalling Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for Windows
Jonathan Bloom
 
instaling
instalinginstaling
instaling
tutorialsruby
 
instaling
instalinginstaling
instaling
tutorialsruby
 
instaling
instalinginstaling
instaling
tutorialsruby
 
instaling
instalinginstaling
instaling
tutorialsruby
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction to  Command LineChapter 1: Introduction to  Command Line
Chapter 1: Introduction to Command Line
azzamhadeel89
 
How to Add Swap on Ubuntu
How to Add Swap on UbuntuHow to Add Swap on Ubuntu
How to Add Swap on Ubuntu
VEXXHOST Private Cloud
 
Nessus
NessusNessus
Nessus Software
Nessus SoftwareNessus Software
Nessus Software
Megha Sahu
 
An In-Depth Guide for Cleaning Server Log Data in KNIME
An In-Depth Guide for Cleaning Server Log Data in KNIMEAn In-Depth Guide for Cleaning Server Log Data in KNIME
An In-Depth Guide for Cleaning Server Log Data in KNIME
Ranq.io
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction  to Command LineChapter 1: Introduction  to Command Line
Chapter 1: Introduction to Command Line
azzamhadeel89
 
Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04
Rajendra Singh
 
Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.
Niraj Bharambe
 
Oracle database 12c client quick installation guide 2
Oracle database 12c client quick installation guide 2Oracle database 12c client quick installation guide 2
Oracle database 12c client quick installation guide 2
bupbechanhgmail
 
Oracle database 12c client quick installation guide 7
Oracle database 12c client quick installation guide 7Oracle database 12c client quick installation guide 7
Oracle database 12c client quick installation guide 7
bupbechanhgmail
 
Troubleshooting mule
Troubleshooting muleTroubleshooting mule
Troubleshooting mule
Son Nguyen
 

Similar to Fixing 403 Forbidden Nginx Errors (20)

Updating Neos – Why, When and How - 2024 edition
Updating Neos – Why, When and How - 2024 editionUpdating Neos – Why, When and How - 2024 edition
Updating Neos – Why, When and How - 2024 edition
 
Snort ppt
Snort pptSnort ppt
Snort ppt
 
Keeping Your Joomla! Site Secure
Keeping Your Joomla! Site SecureKeeping Your Joomla! Site Secure
Keeping Your Joomla! Site Secure
 
Apache logs monitoring
Apache logs monitoringApache logs monitoring
Apache logs monitoring
 
Installing Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for WindowsInstalling Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for Windows
 
instaling
instalinginstaling
instaling
 
instaling
instalinginstaling
instaling
 
instaling
instalinginstaling
instaling
 
instaling
instalinginstaling
instaling
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction to  Command LineChapter 1: Introduction to  Command Line
Chapter 1: Introduction to Command Line
 
How to Add Swap on Ubuntu
How to Add Swap on UbuntuHow to Add Swap on Ubuntu
How to Add Swap on Ubuntu
 
Nessus
NessusNessus
Nessus
 
Nessus Software
Nessus SoftwareNessus Software
Nessus Software
 
An In-Depth Guide for Cleaning Server Log Data in KNIME
An In-Depth Guide for Cleaning Server Log Data in KNIMEAn In-Depth Guide for Cleaning Server Log Data in KNIME
An In-Depth Guide for Cleaning Server Log Data in KNIME
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction  to Command LineChapter 1: Introduction  to Command Line
Chapter 1: Introduction to Command Line
 
Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04Newgenlib Installation on Ubuntu 12.04
Newgenlib Installation on Ubuntu 12.04
 
Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.
 
Oracle database 12c client quick installation guide 2
Oracle database 12c client quick installation guide 2Oracle database 12c client quick installation guide 2
Oracle database 12c client quick installation guide 2
 
Oracle database 12c client quick installation guide 7
Oracle database 12c client quick installation guide 7Oracle database 12c client quick installation guide 7
Oracle database 12c client quick installation guide 7
 
Troubleshooting mule
Troubleshooting muleTroubleshooting mule
Troubleshooting mule
 

More from VEXXHOST Private Cloud

10 Essential Laravel 4 Packages Everyone Should Use.pptx
10 Essential Laravel 4 Packages Everyone Should Use.pptx10 Essential Laravel 4 Packages Everyone Should Use.pptx
10 Essential Laravel 4 Packages Everyone Should Use.pptx
VEXXHOST Private Cloud
 
How To Install Rails & Nginx with Passenger on Ubuntu
How To Install Rails & Nginx with Passenger on UbuntuHow To Install Rails & Nginx with Passenger on Ubuntu
How To Install Rails & Nginx with Passenger on Ubuntu
VEXXHOST Private Cloud
 
How To Create a SSL Certificate on Nginx for Ubuntu.pptx
How To Create a SSL Certificate on Nginx for Ubuntu.pptxHow To Create a SSL Certificate on Nginx for Ubuntu.pptx
How To Create a SSL Certificate on Nginx for Ubuntu.pptx
VEXXHOST Private Cloud
 
Getting Started with MEAN Stack
Getting Started with MEAN StackGetting Started with MEAN Stack
Getting Started with MEAN Stack
VEXXHOST Private Cloud
 
How To Securely Set Up Shipyard 2.0.10 with TLS on CoreOS
How To Securely Set Up Shipyard 2.0.10 with TLS on CoreOSHow To Securely Set Up Shipyard 2.0.10 with TLS on CoreOS
How To Securely Set Up Shipyard 2.0.10 with TLS on CoreOS
VEXXHOST Private Cloud
 
WordPress App on Ubuntu 14.04 LTS
WordPress App on Ubuntu 14.04 LTSWordPress App on Ubuntu 14.04 LTS
WordPress App on Ubuntu 14.04 LTS
VEXXHOST Private Cloud
 
How to deploy a MariaDB Galera cluster on Ubuntu 14.04
How to deploy a MariaDB Galera cluster on Ubuntu 14.04How to deploy a MariaDB Galera cluster on Ubuntu 14.04
How to deploy a MariaDB Galera cluster on Ubuntu 14.04
VEXXHOST Private Cloud
 
How To Mitigate & Fix OpenSSL Heartbeat on CentOS or Ubuntu
How To Mitigate & Fix OpenSSL Heartbeat on CentOS or UbuntuHow To Mitigate & Fix OpenSSL Heartbeat on CentOS or Ubuntu
How To Mitigate & Fix OpenSSL Heartbeat on CentOS or Ubuntu
VEXXHOST Private Cloud
 
How To Install Ruby on Rails on Ubuntu
How To Install Ruby on Rails on UbuntuHow To Install Ruby on Rails on Ubuntu
How To Install Ruby on Rails on Ubuntu
VEXXHOST Private Cloud
 
How To Run Nginx in a Docker Container on Ubuntu 16.04
How To Run Nginx in a Docker Container on Ubuntu 16.04How To Run Nginx in a Docker Container on Ubuntu 16.04
How To Run Nginx in a Docker Container on Ubuntu 16.04
VEXXHOST Private Cloud
 
How To Install & Configure Varnish with Apache on Ubuntu
How To Install & Configure Varnish with Apache on UbuntuHow To Install & Configure Varnish with Apache on Ubuntu
How To Install & Configure Varnish with Apache on Ubuntu
VEXXHOST Private Cloud
 
CentOS 6 to CentOS 7 Upgrade Procedure
CentOS 6 to CentOS 7 Upgrade ProcedureCentOS 6 to CentOS 7 Upgrade Procedure
CentOS 6 to CentOS 7 Upgrade Procedure
VEXXHOST Private Cloud
 
How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04
VEXXHOST Private Cloud
 
How to setup OpenVPN Server and Client on Ubuntu 14.04
How to setup OpenVPN Server and Client on Ubuntu 14.04How to setup OpenVPN Server and Client on Ubuntu 14.04
How to setup OpenVPN Server and Client on Ubuntu 14.04
VEXXHOST Private Cloud
 
How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...
How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...
How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...
VEXXHOST Private Cloud
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub Clone
VEXXHOST Private Cloud
 

More from VEXXHOST Private Cloud (16)

10 Essential Laravel 4 Packages Everyone Should Use.pptx
10 Essential Laravel 4 Packages Everyone Should Use.pptx10 Essential Laravel 4 Packages Everyone Should Use.pptx
10 Essential Laravel 4 Packages Everyone Should Use.pptx
 
How To Install Rails & Nginx with Passenger on Ubuntu
How To Install Rails & Nginx with Passenger on UbuntuHow To Install Rails & Nginx with Passenger on Ubuntu
How To Install Rails & Nginx with Passenger on Ubuntu
 
How To Create a SSL Certificate on Nginx for Ubuntu.pptx
How To Create a SSL Certificate on Nginx for Ubuntu.pptxHow To Create a SSL Certificate on Nginx for Ubuntu.pptx
How To Create a SSL Certificate on Nginx for Ubuntu.pptx
 
Getting Started with MEAN Stack
Getting Started with MEAN StackGetting Started with MEAN Stack
Getting Started with MEAN Stack
 
How To Securely Set Up Shipyard 2.0.10 with TLS on CoreOS
How To Securely Set Up Shipyard 2.0.10 with TLS on CoreOSHow To Securely Set Up Shipyard 2.0.10 with TLS on CoreOS
How To Securely Set Up Shipyard 2.0.10 with TLS on CoreOS
 
WordPress App on Ubuntu 14.04 LTS
WordPress App on Ubuntu 14.04 LTSWordPress App on Ubuntu 14.04 LTS
WordPress App on Ubuntu 14.04 LTS
 
How to deploy a MariaDB Galera cluster on Ubuntu 14.04
How to deploy a MariaDB Galera cluster on Ubuntu 14.04How to deploy a MariaDB Galera cluster on Ubuntu 14.04
How to deploy a MariaDB Galera cluster on Ubuntu 14.04
 
How To Mitigate & Fix OpenSSL Heartbeat on CentOS or Ubuntu
How To Mitigate & Fix OpenSSL Heartbeat on CentOS or UbuntuHow To Mitigate & Fix OpenSSL Heartbeat on CentOS or Ubuntu
How To Mitigate & Fix OpenSSL Heartbeat on CentOS or Ubuntu
 
How To Install Ruby on Rails on Ubuntu
How To Install Ruby on Rails on UbuntuHow To Install Ruby on Rails on Ubuntu
How To Install Ruby on Rails on Ubuntu
 
How To Run Nginx in a Docker Container on Ubuntu 16.04
How To Run Nginx in a Docker Container on Ubuntu 16.04How To Run Nginx in a Docker Container on Ubuntu 16.04
How To Run Nginx in a Docker Container on Ubuntu 16.04
 
How To Install & Configure Varnish with Apache on Ubuntu
How To Install & Configure Varnish with Apache on UbuntuHow To Install & Configure Varnish with Apache on Ubuntu
How To Install & Configure Varnish with Apache on Ubuntu
 
CentOS 6 to CentOS 7 Upgrade Procedure
CentOS 6 to CentOS 7 Upgrade ProcedureCentOS 6 to CentOS 7 Upgrade Procedure
CentOS 6 to CentOS 7 Upgrade Procedure
 
How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04
 
How to setup OpenVPN Server and Client on Ubuntu 14.04
How to setup OpenVPN Server and Client on Ubuntu 14.04How to setup OpenVPN Server and Client on Ubuntu 14.04
How to setup OpenVPN Server and Client on Ubuntu 14.04
 
How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...
How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...
How To Setup Highly Available Web Servers with Keepalived & Floating IPs on U...
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub Clone
 

Recently uploaded

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Fixing 403 Forbidden Nginx Errors

  • 1.
  • 2. FIXING 403 FORBIDDEN NGINX ERRORS • HTTP errors are pesky and typically hard to resolve without the right tools. • However, with proper investigation and tools, you can easily identify the source of a problem and fix it just as fast. • In order to debug or fix 403 Forbidden Nginx errors, all you have to do is check the correct error logs and take the proper action to resolve it. • We’ll go over how to check the error logs and the possible scenarios that typically cause these errors.
  • 3. FIXING 403 FORBIDDEN NGINX ERRORS Finding Error Logs • If you know exactly where the error logs of your Nginx server are, you can skip onto the next section. • If you’re not sure where to find the error logs of your Nginx server, then be sure to continue this section. • The path for error logs can change a lot depending on how Nginx was installed on the server and the Linux distribution. • If you do not know where your error logs are and you have a hard time going through Nginx configuration, we can use a very small and useful Linux tool with the name of lsof which gives us all the open files associated to a specific process. • This will help us find the error log for your web server.
  • 4. FIXING 403 FORBIDDEN NGINX ERRORS • The first step of this is to check for the process ID of the main Nginx process, you can run the following command and except output somewhat similar to the one indicated below: $ ps x | grep nginx 29229 ? S 0:00 nginx: master process /usr/sbin/nginx • The first column of each row is the process ID, as we can see, the main/master process ID is 29229 in this case, however this will change in every system. • Once you have the process ID, you will be able to use the lsof too to get all open files associated to this process by running the following. • We’ve trimmed the output to the part you should be looking for, as there might be a lot more data when you run that command:
  • 5. FIXING 403 FORBIDDEN NGINX ERRORS • As you can see from the above output, we can see that one of the files that are open by this Nginx installation is /var/log/nginx/error.log which (by the file name) does look like an error log. • We’ve now identified the path of our Nginx error log and we can move onto finding the reason behind our pesky HTTP error.
  • 6. FIXING 403 FORBIDDEN NGINX ERRORS Fixing Nginx HTTP errors • Once you have the correct error log file, it’s time to watch for errors. • In our experience, the best way to do this is by running a continuous stream of the error log in your shell screen using the tail utility. $ tail -f /var/log/nginx/error.log • Once you’ve ran this command, tail will continuously output any newly appended content to the error.log as it comes in until you hit Control + C. • We recommend that you clear the entire shell screen to make it easy to identify newly appended content. • You can do this in Windows (PuTTY) by right clicking the PuTTY menu bar and clicking on “Clear Scrollback” or on Mac OS X by clicking Command + K.
  • 7. FIXING 403 FORBIDDEN NGINX ERRORS • Now, you will need to replicate the issue that you are getting. • The error should be printed out right away after you replicate the issue. • For example, if you have a 403 Forbidden error, then you should refresh the page that is causing the problem so that a new error log entry can be appended. • Once that is done, you’ll see a new line in the error log which should hopefully lead you to the right path to fixing the issue. • We’re going to cover a few of the most common issues below.
  • 8. FIXING 403 FORBIDDEN NGINX ERRORS Incorrect Directory Settings • The error below can be caused by two different reasons: incorrect directory index or disallowed directory listing. 2013/08/31 15:03:43 [error] 29231#0: *2098806 directory index of "/usr/share/nginx/static/" is forbidden, client: 1.1.1.1, server: domain.com, request: "GET / HTTP/1.1", host: "domain.com” • If you are trying to list all the files in a folder, you will get that error if the directory does not have directory listing enabled. • You can enable directory listing by adding the following line to your Nginx configuration, you can read more about this option here: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html autoindex on;
  • 9. FIXING 403 FORBIDDEN NGINX ERRORS • The other possibility for that error to come up is if your index setting is incorrect, so for example, you have a index.php file in that folder, however, your index setting is setup to index.htm and index.html. • This means that only these files are checked if no specific file is provided. • If you alter it to something like the following, your index.php file should work: index index.htm index.html index.php;
  • 10. FIXING 403 FORBIDDEN NGINX ERRORS Incorrect Permissions • The error below is generally caused by incorrect Unix permissions, you will need to make sure you have the correct permissions for the entire path. 2013/09/01 00:31:57 [error] 29231#0: *2115270 open() "/usr/share/nginx/static/forbidden" failed (13: Permission denied), client: 1.1.1.1, server: domain.com, request: "GET /forbidden HTTP/1.1", host: "domain.com” • As you see, the file that we are trying to access is /usr/share/nginx/static/forbidden. • In order for Nginx to access it with no problems at all, Nginx must have read permissions for that specific file as well as execute for all the folders above it. • This means that /, /usr, /usr/share, /usr/share/nginx and /usr/share/nginx/static must be executable by Nginx and the file /usr/share/nginx/static/forbidden must be readable by Nginx in this case.
  • 11. FIXING 403 FORBIDDEN NGINX ERRORS Conclusion • We’ve gone through quite a few tools such as tail and lsof. • These are just one of the tools which are offered by Linux which allow system administrators to resolve and debug issues much faster and easier. • The most important factor in resolving system issues is being able to identify the issue properly, resolution is usually the easiest part once the problem is identified. • The larger the toolset of the system administrator, the faster they can identify and fix those problems.