I'm using nginx for the first time. I have an index.html file in my /home/deploy/sites/hello directory. I made sure the folder and index.html is owned by the user deploy and that the file permission is 777.

I then added this entry to /etc/nginx/conf.d/00-app.conf

server {
    listen 80;
    root /home/deploy/sites/hello;
    index index.html;
    server_name hello.com;
    error_log               /var/log/nginx/tbs_error.log;

Then I did a sudo service nginx restart. When I go to hello.com, I get a 403 forbidden error. Anyone know how I might be able fix this issue? All the other nginx sites on this server are still functioning.

  • Check "world"/other access (last x bit) capability for /, /home/, /home/deploy/, /home/deploy/sites/ as well as /home/deploy/sites/hello/. Also, check nginx's error log. – DerfK Nov 17 '15 at 17:50
  • I just went to hello.com and it loaded just fine. – Paul Nov 17 '15 at 23:12
  • Sorry, i mean to say i had to edit my computers host file to map my own hello.com to it. So add teh following entry hello.com to you hosts file in windows and replace with your server ip address. – John Nov 17 '15 at 23:45
  • I might suggest you accept your own answer here - this got bumped to the homepage because its not officially correctly answered. – iandotkelly Nov 15 '19 at 16:30

As per DerfK, I noticed the sites directory did not have executable permission for others. So i did chmod 757 on the sites directory and things worked

  • 2
    Are you sure 757 is appropriate? Would 755 work? – Paul Nov 17 '15 at 23:53

Try with following commands

sudo chown -R www-data:www-data home/deploy/sites/hello* 
sudo chmod -R 0755 home/deploy/sites/hello*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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