I've just got a new server in DigitalOcean and want to try some other things. I want to start a wordpress site so I follow the first 1-3 steps from here: https://deliciousbrains.com/hosting-wordpress-yourself-nginx-php-mysql/. At first everything goes well and I did managed to get the wordpress installed. Unfortunately I am currently having 403 Forbidden on my site.

I am on Ubuntu 14.04 x64. I already stuck for quite sometimes and still have no ideas on whats going on. I even tried to remove the Nginx and reinstall, still the same.

Here is my conf file:

user sylvia;
worker_processes 1;
pid /run/nginx.pid;

events {
        worker_connections 1024;
        # multi_accept on;

http {

        # Basic Settings

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 15;
        types_hash_max_size 2048;
        # server_tokens off;
        client_max_body_size 64m;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

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

        # 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 2;
        # 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/*;

       server {
              listen 80 default_server;
               server_name _;
               return 444;

Any idea?

closed as off-topic by Michael Hampton Jul 29 '18 at 13:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Look at your error logs. – Michael Hampton Oct 4 '15 at 14:38
  • 1
    Please add your virtual host (server) nginx config, as well as the content of nginx error log... – Mehdi Jan 11 '16 at 15:16
  • Do you have any security modules active? I know apache's mod_security2 can throw 403's happily on every page when misconfigured. – ItsMidas Jul 29 '16 at 7:18

Forbidden means NGINX is not able to open the directory in which the files are stored.

The NGINX error_logs will give you the exact cause for the problem.

The logs are stored in /var/logs/nginx/error_log. Just open the file and go the the last lines and see what exact error your'e getting.

Ideally, doing a chmod 755 directory will solve the issue.


I had the a 403 problem as well, which was caused by the mode of directory.

I set the root directory under home,and the default mode for home directory is 600.

Then I found this article https://gist.github.com/jhjguxin/6208474 , and tried to change the root directory to 755, and the problem was solved.

So it seems that the default permissions on user home directories in Ubuntu 12.04 is 700.** Nginx needs to have read permission the files that should be served AND have execute permission in each of the parent directories along the path from the root to the served files.**

You can give your user directory these permissions by running

chmod 701 user_home

You may also use 755, which is the default permission setting on the home directory on many systems.

The directories/files in your web root can belong to the www-data user or your regular personal user as long as the user/group that nginx runs as (as defined in nginx.conf) has READ permission on all files to be served and execute permission on all web root directories.

  • Adding info from the link would improve your answer – Dave M Jun 24 '16 at 10:48

Most probably it is a permission issue. Give permission to www-data user to access your web root directory. Aur you can also give ownership.

chown -R www-data:www-data /path/to/your/directory

This case is occur when you run Mamp with the Server Nginx and nginx server needed configuration of each working folder/directory. for the nginx configuration you can go in nginx.conf file on path


and write this script.

http {
    server {

    location ~* /test(.*)$ {
    root             C:/MAMP/htdocs/test;
        index            index.php;

        location ~ \.php$ {
            try_files        $uri =404;
            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include          fastcgi_params;


note: in this script test is my working directory. you can replace this name.


If you're simply trying to list directory contents use autoindex on; like:

location /somedir {
       autoindex on;

Not the answer you're looking for? Browse other questions tagged or ask your own question.