V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
o618
V2EX  ›  问与答

nginx启动和配置好后报错,帮忙看看

  •  
  •   o618 · 2014-01-28 11:13:33 +08:00 · 13084 次点击
    这是一个创建于 3960 天前的主题,其中的信息可能已经有所发展或是发生改变。
    nginx -c /etc/nginx/nginx.conf

    nginx: [emerg] getpwnam("nginx") failed in /etc/nginx/nginx.conf:1
    10 条回复    1970-01-01 08:00:00 +08:00
    loading
        1
    loading  
       2014-01-28 11:15:30 +08:00 via iPhone   ❤️ 1
    敢贴出nginx.conf几行?
    cax0ch
        2
    cax0ch  
       2014-01-28 11:15:36 +08:00   ❤️ 1
    用户名不存在吧? cat /etc/passwd | grep nginx 有输出吗
    o618
        3
    o618  
    OP
       2014-01-28 11:17:55 +08:00
    @loading 敢!



    user nginx;
    worker_processes 1;

    error_log /var/log/nginx/error.log;
    pid /var/run/nginx.pid;

    events {
    worker_connections 1024;
    use epoll;
    }

    http {
    # Enumerate all the Tornado servers here
    upstream frontends {
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
    server 127.0.0.1:8003;
    server 127.0.0.1:8004;
    }

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;

    keepalive_timeout 65;
    proxy_read_timeout 200;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    gzip on;
    gzip_min_length 1000;
    gzip_proxied any;
    gzip_types text/plain text/css text/xml
    application/x-javascript application/xml
    application/atom+xml text/javascript;

    # Only retry if there was a communication error, not a timeout
    # on the Tornado server (to avoid propagating "queries of death"
    # to all frontends)
    proxy_next_upstream error;

    server {
    listen 80;
    server_name localhost;
    # Allow file uploads
    client_max_body_size 50M;

    location static/ {
    root /srv/www/goodman/;
    if ($query_string) {
    expires max;
    }
    }
    location = /favicon.ico {
    rewrite (.*) /static/favicon.ico;
    }
    location = /robots.txt {
    rewrite (.*) /static/robots.txt;
    }

    location / {
    proxy_pass_header Server;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_pass http://frontends;
    }
    }
    }
    o618
        4
    o618  
    OP
       2014-01-28 11:18:23 +08:00
    @cax0ch 无输出
    loading
        5
    loading  
       2014-01-28 11:32:19 +08:00 via iPhone   ❤️ 1
    getpwnam 明显没有nginx这个名字的用户,用别的用户或建一个。
    o618
        6
    o618  
    OP
       2014-01-28 11:37:15 +08:00
    @loading 我是在ubuntu上默认安装的,默认用户名是root?
    xiaobu
        7
    xiaobu  
       2014-01-28 11:45:03 +08:00   ❤️ 1
    useradd nginx
    o618
        8
    o618  
    OP
       2014-01-28 11:45:56 +08:00
    @xiaobu thanks a lot
    AstroProfundis
        9
    AstroProfundis  
       2014-01-28 12:00:37 +08:00
    @o618 debian 系的系统上默认应该是 www-data 吧
    cax0ch
        10
    cax0ch  
       2014-01-28 13:39:37 +08:00
    useradd nginx 或者把 第一行的nginx改成 www-data 即可。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2815 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 11:58 · PVG 19:58 · LAX 03:58 · JFK 06:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.