LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-19-2016, 05:57 AM   #1
vgaven
LQ Newbie
 
Registered: Jul 2016
Posts: 1

Rep: Reputation: Disabled
Webserver Root Folder Permission denied for Nginx Server Blocks on CentOS 7.2


Hi,
I have a problem I have installed nginx on Centos 7 and I get an 403 on frontend and if I run

sudo tail -f /var/log/nginx/error.log

I get an permission denied error

2016/07/18 22:11:47 [error] 32598#32598: *7 "/var/www/example.com/html/index.html" is forbidden (13: Permission denied), client: XX.XXX.XXX.XXX, server: example.com, request: "GET / HTTP/1.1", host: "example.com"

the owner of the directory

/var/www/example.com/html/index.html
is not root, it is a user which I create and give him admin/root priviliges so it can use sudo.

How can I fix that?

###Update

First I am not using apache and I already give the permission

sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www
logged in as the admin user

and also tried to give nginx the permission (Permission the same for parent directories)

sudo chown -R nignx:nginx /var/www/example.com/html
sudo chmod -R 755 /var/www
 
Old 07-19-2016, 07:03 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Welcome to LQ!

Please stop abusing chmod/chown until someone who can help you steps up.
 
Old 07-19-2016, 03:48 PM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,480

Rep: Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759Reputation: 1759
Quote:
I get an permission denied error

2016/07/18 22:11:47 [error] 32598#32598: *7 "/var/www/example.com/html/index.html" is forbidden (13: Permission denied), client: XX.XXX.XXX.XXX, server: example.com, request: "GET / HTTP/1.1", host: "example.com"
Most likely a SELinux problem. Check this post to see what you can do
 
Old 07-27-2016, 06:02 AM   #4
Elizine
Member
 
Registered: Aug 2015
Posts: 54
Blog Entries: 1

Rep: Reputation: Disabled
Webserver Root Folder Permission denied for Nginx Server Blocks on CentOS 7.2

SELinux might not be permitting Nginx to proxy to my server. Running the command below might fix the issue.

Code:
 /usr/sbin/setsebool httpd_can_network_connect true
 
Old 07-28-2017, 04:03 AM   #5
huuphang
LQ Newbie
 
Registered: Nov 2014
Location: VN
Distribution: fedora
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by vgaven View Post
Hi,
I have a problem I have installed nginx on Centos 7 and I get an 403 on frontend and if I run

sudo tail -f /var/log/nginx/error.log

I get an permission denied error

2016/07/18 22:11:47 [error] 32598#32598: *7 "/var/www/example.com/html/index.html" is forbidden (13: Permission denied), client: XX.XXX.XXX.XXX, server: example.com, request: "GET / HTTP/1.1", host: "example.com"

the owner of the directory

/var/www/example.com/html/index.html
is not root, it is a user which I create and give him admin/root priviliges so it can use sudo.

How can I fix that?

###Update

First I am not using apache and I already give the permission

sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www
logged in as the admin user

and also tried to give nginx the permission (Permission the same for parent directories)

sudo chown -R nignx:nginx /var/www/example.com/html
sudo chmod -R 755 /var/www
The first, To check selinux
The second, use namei command to check tree permission as bellow
Code:
namei -l /var/www/example.com/html
i hope this will help you
For example, How To Install Wordpress with nginx on CentOS 6
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync - permission denied (13) on Centos 6.5 - even when run as root Kernel Fergus Linux - Server 3 03-06-2014 09:54 AM
EasyTag permission denied to home folder andy_o Linux - Software 5 01-10-2013 05:48 PM
mkdir throws Permission Denied error in a directoy even with root ownership and 777 permission surajchalukya Linux - Security 14 09-03-2012 08:34 AM
permission denied if I want to create new folder dodo1983 Linux - Newbie 2 08-14-2004 10:46 PM
Permission denied opening a folder phoenixofwater Linux - Newbie 3 07-26-2004 09:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration