You are not logged in.

#1 2023-08-03 13:52:51

larmet
Member
Registered: 2023-08-03
Posts: 4

Can't run nginx as normal user [SOLVED]

I followed the instructions from here: https://wiki.archlinux.org/title/nginx# … ng_systemd
Here is my nginx.conf:

user user;
worker_processes auto;
worker_cpu_affinity auto;

events {
    multi_accept on;
    worker_connections 1024;
}

http {
    charset utf-8;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    server_tokens off;
    log_not_found off;
    types_hash_max_size 4096;
    client_max_body_size 16M;

    # MIME
    include mime.types;
    default_type application/octet-stream;

    # logging
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log warn;

    # load configs
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    server {
        listen 7777;
        listen [::]:7777;
        server_name site.com;
        root /home/user/site;
        location / {
            index index.php index.html index.htm;
        }
    }
}

My user.conf:

[Service]
User=user
Group=user
RuntimeDirectory=nginx
StateDirectory=nginx
LogsDirectory=nginx
PIDFile=/run/nginx/nginx.pid
ExecStart=
ExecStart=/usr/bin/nginx -g 'pid /run/nginx/nginx.pid; error_log stderr;'
ExecReload=
ExecReload=/usr/bin/nginx -s reload -g 'pid /run/nginx/nginx.pid; error_log stderr;'

After running I see an error:

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/etc/systemd/system/nginx.service; disabled; preset: disabled)
    Drop-In: /etc/systemd/system/nginx.service.d
             └─user.conf
     Active: active (running) since Thu 2023-08-03 15:44:50; 3min 4s ago
    Process: 5014 ExecStart=/usr/bin/nginx -g pid /run/nginx/nginx.pid; error_log stderr; (code=exited, status=0/SUCCESS)
   Main PID: 5016 (nginx)
      Tasks: 3 (limit: 4684)
     Memory: 2.7M
        CPU: 56ms
     CGroup: /system.slice/nginx.service
             ├─5016 "nginx: master process /usr/bin/nginx -g pid /run/nginx/nginx.pid; error_log stderr;"
             ├─5017 "nginx: worker process"
             └─5018 "nginx: worker process"

Aug 03 15:44:50 linux systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 03 15:44:50 linux nginx[5014]: 2023/08/03 15:44:50 [warn] 5014#5014: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
Aug 03 15:44:50 linux systemd[1]: Started A high performance web server and a reverse proxy server.

Help please to run this without using aur package and dockers and other complex manipulations

Last edited by larmet (2023-08-03 14:20:35)

Offline

#2 2023-08-03 13:55:58

larmet
Member
Registered: 2023-08-03
Posts: 4

Re: Can't run nginx as normal user [SOLVED]

So the server is running but a warning is hanging, what should I do about it

Aug 03 15:44:50 linux nginx[5014]: 2023/08/03 15:44:50 [warn] 5014#5014: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1

Last edited by larmet (2023-08-03 13:56:26)

Offline

#3 2023-08-03 14:02:15

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,640

Re: Can't run nginx as normal user [SOLVED]

Why do you have 'user user;' in nginx.conf?

Offline

#4 2023-08-03 14:08:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,615
Website

Re: Can't run nginx as normal user [SOLVED]

Title wrote:

Can't run...

But it does run, and it seems to just fine.

larmet wrote:

After running I see an error

What error?  There is a warning there which is 1) pretty straitforward, and 2) not fatal.

So what's the actual problem?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2023-08-03 14:16:50

larmet
Member
Registered: 2023-08-03
Posts: 4

Re: Can't run nginx as normal user [SOLVED]

Scimmia wrote:

Why do you have 'user user;' in nginx.conf?

Because I need to run nginx as user user

Offline

#6 2023-08-03 14:20:10

larmet
Member
Registered: 2023-08-03
Posts: 4

Re: Can't run nginx as normal user [SOLVED]

Trilby wrote:
Title wrote:

Can't run...

But it does run, and it seems to just fine.

larmet wrote:

After running I see an error

What error?  There is a warning there which is 1) pretty straitforward, and 2) not fatal.

So what's the actual problem?

And I figured it out, it turns out user is not needed because I registered it in systemd. It was a mistake I'm using a translator

Offline

Board footer

Powered by FluxBB