N
N
NonRealDeveloper2011-07-14 14:00:31
Nginx
NonRealDeveloper, 2011-07-14 14:00:31

Nginx returns 403 when index is present?

I'm not strong in nginx, today I ran into a small problem.
If you specify:

location / {
    root   /home/www/site.ru;
    index  index.html index.htm;
  }

then everything works
If you specify:
location / {
    root   /home/anotheruser/repos/site.ru;
    index  index.html index.htm;
  }

it returns 403 when requesting site.ru , and this despite the fact that the directory exists, and it contains the index.html file.
Actually the question is how can I make the site work from the /home/anotheruser/repos/site.ru directory?
nginx version: 1.0.4.
The mercurial repository is located in the /home/anotheruser/repos/site.ru directory, the mercurial server is running as the user anotheruser - maybe this somehow affects?
ps: There was an idea to create a hard link from the directory /home/anotheruser/repos/site.ru to the directory /home/www/site.ru

Answer the question

In order to leave comments, you need to log in

8 answer(s)
X
xaker1, 2011-07-14
@xaker1

403 - access denied.
Maybe the user under which nginx is running does not have permission to read /home/anotheruser/repos/site.ru?

V
Vlad Zhivotnev, 2011-07-14
@inkvizitor68sl

Miracles don't happen. See chmod, chown, acl, apparmor, selinux. Also, Anginix does not always follow symlinks and hardlinks, I don’t remember the conditions.

V
VBart, 2011-07-14
@VBart

Why not add the user nginx is running as to the group your mercurial is running as? This is exactly what you want.

N
NonRealDeveloper, 2011-07-14
@NonRealDeveloper

rights are available, 755 to all folders starting from /home/anotheruser and ending with /home/anotheruser/repos/site.ru

B
b0beR, 2011-07-14
@b0beR

And yet, most likely, the rights to one of the parent folders are not set.
If at least one of them the user on behalf of which nginx is running does not have read rights, then there will be a 403.

P
Puma Thailand, 2011-07-14
@opium

ls -lF
files and folders

N
NonRealDeveloper, 2011-07-14
@NonRealDeveloper

Temporarily solved the problem - in .hg / hgrc of the project I wrote:

[hooks]
changegroup = hg update >&2 && cp -R /home/hg/repos/site.ru/* /home/www/site.ru >&2

And put write permissions on the /home/www/site.ru directory.
Now, with every hg push , the site auto-updates.

S
Sergey, 2019-06-02
@Ermak1

Also faced the same problem. site.ru/index.php opens, but just site.ru issues 403. I solved the problem by leaving root /var/www/site.ru in the host settings and created a site.ru symbolic link in the /var/www/ folder to /home/ user/www/site.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question