Report this

What is the reason for this report?

Nginx 403 after files have been moved from other provider

Posted on August 17, 2014

Greetings to all,

First I would like to thank DigitalOcean for their excellent tutorials and How-To’s and to all kind members supplying really excellent stuff. Information found here is a true gem!

Now I have a problem with webserver nginx and I don’t know how to solve if directories does not contain index.php. I get 403 error!

For example lets say I have folder structure as follows:

/contact/ (folder)

  • contact.php

/about/ (folder)

  • about.php

Do I have to rename the files to index.php or can it be solved in any other way?

Cheers to all in the ocean!



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.

By default, if you go to a directory’s url, only the index file be shown. This is configured by this setting in your Nginx configuration,

index index.php index.html index.htm;

That said, your solution is generally how it is handled for a non-standard directory:

location = /contact/ {
        rewrite ^(.*)$ /contact/contact.php;
}

Thanks for following up and sharing your solution!

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.