English 中文(简体)
nginx: /usr/ local/nginx/conf/nginx.conf:43
原标题:nginx: [emerg] unknown directive "set" in /usr/local/nginx/conf/nginx.conf:43
  • 时间:2011-03-15 07:12:38
  •  标签:
  • nginx

我将原产地做成像,使推进模块(http://pushmodule.slact.net)能够安装原产地服务器。

When I am trying to restart i get: nginx: [emerg] unknown directive "set" in /usr/local/nginx/conf/nginx.conf:43

在此,我conf:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main   $remote_addr - $remote_user [$time_local] "$request"  
    #                   $status $body_bytes_sent "$http_referer"  
    #                   "$http_user_agent" "$http_x_forwarded_for" ;

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8080;
        server_name  localhost;

    location /publish {
        # Название переменной с идентификатором канала
        # в нашем примере "cid", т.е. запрос будет таким:
        # http://example.com/publish?cid=s42378fwe
        set $push_channel_id $arg_cid;
        push_publisher;

        # Отключаем хранение очереди (сообщение удаляется после доставки)
        push_store_messages off;
    }

    location /listen {
        push_subscriber;

        # Обслуживать только первого "слушателя"
        # Остальным отправляем 403
        push_subscriber_concurrency first;

        # Идентификатор канала
        set $push_channel_id $arg_cid;

        # Тип ответа
        default_type text/plain;
    }


        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ .php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ .php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache s document root
        # concurs with nginx s one
        #
        #location ~ /.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

系统: ubuntu 10.10 x86。 谁能帮助我?

最佳回答

之所以出现这一错误,是因为Nginx没有知道在地点/公共场所的“push_publisher”。 推进模块不属于你特定原产地的建筑。

你们是否下载和编辑该模块,并安装新编的正文,安装到乌班图的违约地点?

自您生以来。 专栏/单位 我会猜测,你正在从不包含推力模块的纬度(超低植被安装 n)中操作缺端。 从源头下载和安装 n,包括推介模块,它应当发挥作用。 随同你制作的“/opt/nginx”等名录,你们知道,你只是忙于执行“OS”一揽子计划。

问题回答

The default nginx doesn t support ""HttpRewriteModule which defines the "set" directive"" , you have to compile, install and use nginx from source: - Download nginx source from here

  • cd to the directory containing the downloaded file
  • uncompress it: tar xvfz nginx-"your_version"
  • cd nginx-"your_version"
  • ./configure :you can add other modules to the compilation of nginx in this way:

./configure --with-"the module_to_add" you can get rid of some modules in this way:

页: 1

例如,“http://rewrite_module”模块要求“pcre”和“pcre-devel”要么安装,要么将其排除在汇编之外(http://configure_ Without-http_rewrite_module)。

缩略语 页: 1

  • make
  • sudo make install

After new nginx installed, we have to use it instead of the default one: The Binary of the new nginx is in:

/usr/ local/nginx/sbin (你可以从那里审判)

  • Change init.d to use the new nginx:

sudo nano /etc/init.d/nginx

3. 查明这两行:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx

是否将这些内容改为:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin
DAEMON=/usr/local/nginx/sbin/nginx

或我建议评论老的,并增加新内容,以便最终:

#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin
#DAEMON=/usr/sbin/nginx
DAEMON=/usr/local/nginx/sbin/nginx

(经过修改后,为节约和放弃纳米,新闻(Ctrl+O)然后出版(Ctrl+x)

如果是的话,支持你原有的原产地组合,支持新的原产地(大草原)。

设立配置:

cd /usr/ local/nginx/sbin

sudo /nginx -t -c /usr/ local/nginx/conf/nginx.conf.

1. 重新开端:

sudo /etc/init.d/nginx 恢复

or you can reboot your os instead of the last tow instructions. Now nginx support "set" directive. Hope this helps.





相关问题
nginx behaved differently for different version

I have used docker image nginx:1.18.0-alpine previously and below is the conf. It works as expected app.localhost --> points to the block wit server_name app.* localhost --> points to the other ...

What s limiting my PHP resources?

I m having a problem getting more memory out of PHP. This is the error message: Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 82 bytes) in ... Yet: I ve set ...

what user I should run my nginx or php-fpm processes

Ok. Im little bit confused about those permissions in linux so please people help me out. The trouble is that I dont want to run server as root, so I created another user with sudo privileges so he ...

Nginx 301 redirect inc. set cookie

what I m looking for is the ability for nginx to detect that a url has the query string variable cid. for example www.adomain.com/froggy?cid=12&as=false (query string can be solo or mixed with ...

Nginx raises 404 when using format => js

I upload images to my App using Ajax and an Iframe. In Development everything works like a charm. But in production Nginx suddenly raises a 404 error. When I look into the log, the request never hits ...

nginx errors readv() and recv() failed

I use nginx along with fastcgi. I see a lot of the following errors in the error logs readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

热门标签