N
N
Nikolay2019-03-28 16:20:00
Nginx
Nikolay, 2019-03-28 16:20:00

Why are there no rights for nginx?

Simple config

server {
    listen 80;
    server_name somesite.ru www.somesite.ru;

    root /home/admin/web/somesite.ru/www/;
    index index.php;

    location ~* \.(jpg|css|png|js|ico|html)$ {
        access_log off;
        expires max;
        log_not_found off;
    }

    location / {
        set $somesite_path /home/admin/web/somesite.ru/www;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $somesite_path$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $root_path;
    }
}

When you try to go to somesite.ru - returns an error 403, no access.
add logging
access_log /home/admin/web/somesite.ru/log/access.log combined;
error_log /home/admin/web/somesite.ru/log/error.log debug;

and when starting nginx it says:
nginx[21989]: nginx: [emerg] open() "/home/admin/web/somesite.ru/log/access.log" failed (13: Permission denied)

The default user for nginx is nginx.
The /home/admin/ folder is owned by admin:admin.
The nginx user has been added to the admin group.
What am I doing wrong, tell me please?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2019-03-28
@ky0

Your log file is not created. Do as usual:

access_log /var/log/nginx/somesite.access.log;
error_log /var/log/nginx/somesite.error.log;

And in the console
mkdir -p /var/log/nginx; chown nginx: var/log/nginx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question