403 Error when i enbale https on NGINX

Posted March 2, 2018 52.5k views
NginxUbuntu 16.04

I am getting a 403 Forbidden error although when i do the nginx -t command to test my nginx.config files i dont get an erro i have pasted the config below,i need some assistance ASAP.

user www-data;
worker_processes auto;
pid /run/;

events {
    worker_connections 768;
    # multi_accept on;

http {

    # Basic Settings
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

# HTTPS server

server {
        listen 443;
        ssl on;
        ssl_certificate /home/tmususa/ssl/amara.crt;
        ssl_certificate_key /home/tmususa/ssl/*;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
        location / {
        root /var/www/bookstack/public/;
        index index.php,index.html; 
    # Logging Settings

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Gzip Settings

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    # Virtual Host Configs

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*.conf;

#mail {
#   # See sample authentication script at:
#   #
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
edited by kamaln7

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.

Submit an Answer
3 answers

“403 Forbidden” is an all-purpose NGINX error which indicates that you have asked for something that NGINX - for a variety of potential reasons - cannot deliver. “403” is actually an HTTP status code that means that the web server has received and understood your request, but that it cannot take any further action. That’s why you don’t get any errors with the test.

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;

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

Note: These file names are case-sensitive. If the NGINX configuration file specifies index.html but the file is named Index.html, this will cause a “403 Forbidden” error.

In your location block, I see you have a comma after index.php. I don’t think this should be the case.
Remove the comma.

location / {
      root /var/www/bookstack/public/;
      index index.php index.html;

Did you type this configuration here or what? Prefer copy and paste so that we can see exactly whats in your config file. typing may end up introducing other mistakes that are not in your config file.

edited by kamaln7
  • After this change its taking me to this

    (Welcome to nginx!

    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

    For online documentation and support please refer to
    Commercial support is available at

    Thank you for using nginx.)

    What seems to be the problem now ?

  • Managed to fix it thank you its working now

i have the same problem ):