{"id":9330,"date":"2022-03-29T19:41:47","date_gmt":"2022-03-29T14:11:47","guid":{"rendered":"https:\/\/www.skynats.com\/?p=9330"},"modified":"2025-03-12T15:51:39","modified_gmt":"2025-03-12T10:21:39","slug":"digitalocean-403-forbidden-nginx","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/digitalocean-403-forbidden-nginx\/","title":{"rendered":"DigitalOcean 403 Forbidden NGINX Error"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-how-to-fix-digitalocean-403-forbidden-nginx-error\">How to fix Digitalocean 403 forbidden nginx error?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When a client attempts to access a part of the webserver with insufficient permissions, the Nginx 403 Forbidden error is generated and displayed to the user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Let&#8217;s take a look at the ways our Technical Support team took to fix<\/strong> <strong>it:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Check to see if nginx is up and running.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You must see something like this if nginx is up and running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx.service - The nginx HTTP Server\n   Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\n   Active: active (running) since Tue 2019-11-19 09:37:46 UTC; 2 days ago\n     Docs: https:\/\/httpd.nginx.org\/docs\/2.4\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If nginx is not running, the output will be as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx.service - The nginx HTTP Server Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled) Active: inactive (dead) since Fri 2019-11-22 08:41:01 UTC; 39s ago Docs: https:\/\/httpd.nginx.org\/docs\/2.4\/<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>If nginx isn&#8217;t already running, you can start it by typing:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then double-check the status to ensure that nginx is still running.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>If nginx failed to start after a reboot, you can allow it so that it starts the next time you reboot:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check your nginx config syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -t<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you receive an error, you must first resolve the issue before restarting nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart nginx<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>If you get <em>Syntax OK<\/em> when running <em>nginx -t<\/em>, your configuration is accurate, so verify your error logs:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tail -f \/var\/log\/nginx\/error.log<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Examine the file and folder permissions in your document root:<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Consider the user which your nginx service is running as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ps auxf | grep nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re using Ubuntu, the user you must be www-data, so ensure that your files and folders are purchased by that user so that nginx can read and write to them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chown -R www-data:www-data \/var\/www\/yourdomain.com<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Then look to see if nginx is using the default ports:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>netstat -plant | grep '80\\|443'<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>At last, confirm if ufw enables TCP connections on port 80 and 443:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ufw status<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Other troubles with the server:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The Index File is Incorrect<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Permissions have been set incorrectly.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Error 403: Client-Side Cause<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As previously stated, the 403 error can also be caused by the user rather than the server. Undertake the basic operations on the client side to fix such problems.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Make sure you are attempting to access the target web location<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Clear the cache in your browser.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Ensure that you can access the web resource through the firewall or proxy.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Are you looking for an answer to another query? <a href=\"https:\/\/www.skynats.com\/contact-us\/\" target=\"_blank\" rel=\"noreferrer noopener\">Contact<\/a> our technical support team.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to fix Digitalocean 403 forbidden nginx error? When a client attempts to access a part of the webserver with insufficient permissions, the Nginx 403 Forbidden error is generated and displayed to the user. Let&#8217;s take a look at the ways our Technical Support team took to fix it: Check to see if nginx is [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[568],"class_list":["post-9330","post","type-post","status-publish","format-standard","hentry","category-blog","tag-403-forbidden-error"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=9330"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9330\/revisions"}],"predecessor-version":[{"id":14404,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9330\/revisions\/14404"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=9330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=9330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=9330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}