Question

Wordpress & NGINX = 403

  • Posted on February 1, 2014
  • cameron1Asked by cameron1

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 ?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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;
    }

From what i can tell here - http://codex.wordpress.org/Nginx - there seems to be a lot more to getting wordpress set up with NGINX than meets the eye. Maybe i am just reading it wrong? <br>Also it says that NGINX wont improve performance much

@Kamal, Still doesnt seem to work :/ <br>This is my whole virtual.conf file at the minute, havnt made a second block untill i get first one working: <br> <br>server { <br> listen 80; <br># listen *:80; <br> server_name broombanklandrovers.com www.broombanklandrovers.com; <br> <br> location / { <br> root /var/www/broombanklandrovers.com/public_html/; <br> index index.php index.html index.htm; <br> } <br> <br> location ~ .php$ { <br> <br> try_files $uri =404; <br> <br> fastcgi_pass 127.0.0.1:9000; <br> <br> fastcgi_index index.php; <br> <br> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; <br> <br> include fastcgi_params; <br> <br> } <br>}