Report this

What is the reason for this report?

Wordpress & NGINX = 403

Posted on February 1, 2014

Hello,

I started a fresh install this morning with no control panel. I am now using command line only.

So i followed below links to install NGINX on Cent Os and also to create 2 virtual hosts: https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-6 https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-centos-6

Then i set up a database for wordpress site. Changed the WP config files for database setting. Went to access site to setup wordpress and am greeted with 403 Forbidden.

So then i checked my NGINX logs and this is what it comes up with:

2014/02/01 12:12:33 [error] 2010#0: *12 directory index of “/var/www/broombanklandrovers.com/public_html/” is forbidden, client: ‘MYIPADDRESS’, server: ‘MYDOMAIN.COM’, request: “GET / HTTP/1.1”, host: ‘“MYDOMAIN.COM”’

Does anyone know why i am getting 403 ?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

I know i am probably late to answer, i hav been searching the answer myself because i encounter the exact problem. Below server block for nginx has solved my issue. I hope it helps

    listen 80;
    listen [::]:80;

    root /var/www/your wordpress content;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name domain or IP address;

    location / {
         try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

<pre>directory index of “/var/www/broombanklandrovers.com/public_html/” is forbidden,</pre> <br>There it is. That’s the error. It says that the directory index of that directory is forbidden, which means that nginx doesn’t have any index files to serve. What’s the output of <code>ls /var/www/broombanklandrovers.com/public_html/</code>? Can you pastebin the whole virtualhost too?

This is the output : <br>index.php wp-blog-header.php wp-includes wp-settings.php <br>license.txt wp-comments-post.php wp-links-opml.php wp-signup.php <br>readme.html wp-config.php wp-load.php wp-trackback.php <br>wp-activate.php wp-content wp-login.php xmlrpc.php <br>wp-admin wp-cron.php <br> <br>and virtual host is: <br> <br># <br># A virtual host using mix of IP-, name-, and port-based configuration <br># <br> <br>server { <br> listen 80; <br># listen *:80; <br> server_name broombanklandrovers.com; <br> <br> location / { <br> root /var/www/broombanklandrovers.com/public_html/; <br> index index.php index.html index.htm; <br> } <br>} <br> <br>server { <br> listen 80; <br># listen *:80; <br> server_name broombankoffroadadventures.com; <br> <br> location / { <br> root /var/www/broombankoffroadadventures.com/public_html/; <br> index index.php index.html index.htm; <br> } <br>}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.