Re: User directive error

2019-01-24 Thread Zhang Chao
Hello! > Why does this error occur (Ubuntu 18.04/nginx 1.14.0)? > > nginx.conf:21 > user www-data; > > error.log > 2019/01/24 19:07:07 [warn] 3526#3526: the "user" directive makes sense only if the master process runs with super- > user privi

Re: Upgrading Nginx executable on the fly

2018-01-07 Thread Zhang Chao
> We have been trying to upgrade the Nginx binary on the fly by invoking USR2 > signal to spawn a new set of master and worker processes with the new > configuration. The question I have is when this new master process is > spawned, after issuing USR2 signal to the existing or the old master > proc

Re: 504 gateway timeouts

2018-01-04 Thread Zhang Chao
> The version that is on the ubuntu servers was 1.10.xx. I just updated it to > > nginx version: nginx/1.13.8 > > And I am still having the same issue. > > How do I "Try to flush out some output early on so that nginx will know that Tomcat is alive." > > The nginx and tomcat connection is working f

Re: Proxy pass and URL rewrite with upstream

2017-12-21 Thread Zhang Chao
Hello! > With this configuration, only works the URL with a trailing slash > "http://systems.ltda.local/phpmyadmin/"; and not > "http://systems.ltda.local/phpmyadmin”. What do you mean of it doesn’t work with the URL without the trailing slash? Does the backend Apache server just returns 404? Th

Re: Problem with proxy_cache_path and limit

2017-12-18 Thread Zhang Chao
Hello! > nginx -v > nginx version: nginx/1.13.7 > # Server globals > user www-data; > worker_processes auto; > worker_rlimit_nofile 65535; > error_log /var/log/nginx/error.log crit; > pid /var/run/nginx.pid; > > > # Worker config > events { > worker_connections 1024; > use epoll; > multi_accept o

Re: lua code in log_by_lua_file not executed when the upstream server is down

2017-12-03 Thread Zhang Chao
Hi! I think you should paste this issue to the openresty mail list https://groups.google.com/forum/#!forum/openresty-en For this problem, have you configured any error_page directives? the error_page will trigger an internal redirect. On 1 December 2017 at 21:10:12, tongshus...@migu.cn (tongshu

Re: [Module] ngx_http_gzip issue : unknown directive "gzip"

2017-10-30 Thread Zhang Chao
Hi! gzip is a directive defined by ngx_http_gzip_filter_module while you only link the ngx_http_gzip_static_module. On 30 October 2017 at 18:34:15, nik mur (nikhil6...@gmail.com) wrote: *http_ssl_module* ___ nginx mailing list nginx@nginx.org http://m

Re: why delta only include the execution time of ngx_process_events not ngx_event_process_posted

2017-10-29 Thread Zhang Chao
I think most of time delta is larger than zero, and i guess that the intention of the if statement for checking delta is non-zero is for ignoring some extreme case that the ngx_process_events handler returns so quickly that the millisecond precision is not enough to display the calling time(less t

Re: failed to run balancer_by_lua*: balancer_by_lua:2: module 'ngx.balancer' not found:

2017-10-26 Thread Zhang Chao
Hi! For using the ngx.balancer, lua-resty-core is necessary. On 27 October 2017 at 01:21:43, rnmx18 (nginx-fo...@forum.nginx.org) wrote: Hi, I am getting the following error when I try to use balancer_by_lua with ngx.balancer in my NGINX configur

Re: Info messages in the log: Connection reset by peer) while sending to client

2017-10-02 Thread Zhang Chao
HI! I think this log message is irrelevant with the keepalive directive inside your upstream configuration block, it just tell you the connection was reset by the client side. On 3 October 2017 at 12:48:02, sachin.she...@gmail.com (nginx-fo...@forum.nginx.org) wrote: Hi, I had an upstream

Re: add headers / gixy

2017-09-12 Thread Zhang Chao
Hi! here is the describtion about add_header may can help you. > Adds the specified field to a response header provided that the response code equals 200, 201, 204, 206, 301, 302, 303, 304, 307, or 308. The value can contain variables. > There could be several add_header directives. These direc

Re: Conditional based cache control

2017-09-09 Thread Zhang Chao
Hi! I think you can consider the ngx_lua, you can achieve your purpose easily by this. :) On 9 September 2017 at 21:36:06, Ish Sookun (ish@lsl.digital) wrote: Hello, I need to write a config that will set the "Cache-Control" value of a resource based on the age of the latter returned by the or

Re: Get rid of args from $request_uri

2017-08-08 Thread Zhang Chao
On 8 August 2017 at 22:02:32, chilly_bang (nginx-fo...@forum.nginx.org) wrote: c0nw0nk Wrote: --- > why don't you use > > $uri Is it not so, that $uri will output an encoded url? $uri is always the one decode once time and merge the slash(if y

Re: nginx limit_req and limit_conn not working to prevent DoS attack

2017-08-01 Thread Zhang Chao
Hi! I don’t think just drop the connection is a good idea, client will never know what happens on the server end. However, the code 444 may help you, nginx just close the connection in this case. On 2 August 2017 at 09:30:01, Phani Sreenivasa Prasad ( nginx-fo...@forum.nginx.org) wrote: Hi All,

Re: connection error bit set to 1

2017-07-31 Thread Zhang Chao
Hello! Is there any network error in your connection? like connection reset by peer, maybe you can set the error log level as low as possible, then find the devil in the error.log. On 31 July 2017 at 22:46:12, Ortal (nginx-fo...@forum.nginx.org) wrote: Hello, I am writing a nginx module. I woul

Re: serving certain file for all but one server{}

2017-07-30 Thread Zhang Chao
Hi! You can rewrite the uri in the special server {} by the “rewrite” directive. On 30 July 2017 at 19:09:27, ST (smn...@gmail.com) wrote: Hello, I have a lot of server{}s with different server_names all over my setup. I want to serve robots_closed.txt instead of robot.txt for all but one doma

Re: Disable NGINX caching 304 Responses from Origin Server

2017-07-24 Thread Zhang Chao
Hi! Have you used the proxy_cache_valid ? Maybe you can add this directive to disable the 304 cache explicitly. proxy_cache_valid 304 0; On 24 July 2017 at 23:20:35, Ryan Barclay (r...@rbftpnetworks.com) wrote: We ha

Re: How to rate-limit jorgee malware scanner?

2017-07-24 Thread Zhang Chao
Hi! Nginx carries with the limit_req_module . I think it is a good helper. On 24 July 2017 at 20:10:05, Gary Sellani (li...@lazygranch.com) wrote: I just detect the use agent and return 444, but every attempt to get a file will show

Re: how nginx deal with gzipped responses when gzip is on

2017-07-13 Thread Zhang Chao
Hi! NGINX will check the Content-Encoding header, so if this header exists, gzip filter will be bypassed. On 14 July 2017 at 02:39:07, foxgab (nginx-fo...@forum.nginx.org) wrote: i configred nginx with gzip directives: http { gzip on; gzip_types text/css application/javascript; gzip_comp_level

Re: Flushing responses in nginx modules

2017-07-12 Thread Zhang Chao
; ngx_http_send_special(r, NGX_HTTP_FLUSH); ctx->counter++; if(ctx->counter == numberOfMessages) { ctx->counter = 0; ngx_http_send_special(r, NGX_HTTP_LAST); ngx_http_finalize_request(r, NGX_OK); // Decrements reference count } else { ngx_add_timer(&ctx->event, 1000); } } } Cheers Johan

Re: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

2017-07-10 Thread Zhang Chao
Hi! Only the root can bind the ports small than 1024. You should start your nginx service with the sudo prefix. On 11 July 2017 at 09:20:40, Viaduct Lists (li...@viaduct-productions.com) wrote: Hi there. Looking to get port 80 serving. Changed to root, but the error keeps the user from running

Re: Flushing responses in nginx modules

2017-07-09 Thread Zhang Chao
Hello! You mustn’t use standard sleep function for it will block Nginx’s events loop, alternatively, you need to put your write event to a timer, set the proper handler when the timer expires. BTW, you should always check the return value of ngx_http_send_header and ngx_http_output_filter. On 10

Re: Writing Header to Logfile

2017-07-07 Thread Zhang Chao
I would like to log a header which is send with the incoming request into a custom log field. How can this be done? you mean the request header? On 7 July 2017 at 23:55:36, mailinglis...@simonhoenscheid.de ( mailinglis...@simonhoenscheid.de) wrote: Hello List, I would like to log a header wh

Re: Does Nginx supports If-Range ?

2017-07-03 Thread Zhang Chao
Hi! I don’t know if it is an expected behaviour or a bug: Scenario 1(OK): If I perform a request with the header Range, Nginx serves the partial content(HTTP 206). Scenario 2 (NOT OK): If I perform a request with the header Range AND the header “If-Range” with the Etag, Nginx serves theentire fi

Re: Nginx 404 while accessing app

2017-06-27 Thread Zhang Chao
Hello! I copied your configuration, it seems a internal redirection cycled, you need to modify it(e.g. change the location / to location /=). After i modified, i didn’t reproduce your problem, the root directive works well. On 27 June 2017 at 22:36:45, AjaySawant (nginx-fo...@forum.nginx.org) wr

Re: Nginx 404 while accessing app

2017-06-27 Thread Zhang Chao
Hello! I copied your configuration, it seems a internal redirection cycled, you need to modify it(e.g. change the location / to location /=). After i modified, i didn’t reproduce your problem, the root directive works well. On 27 June 2017 at 22:36:45, AjaySawant (nginx-fo...@forum.nginx.org) wr

Re: How to log all headers in nginx?

2017-06-06 Thread Zhang Chao
Hi You can traverse the list r->headers_in.headers. On 7 June 2017 at 14:22:38, prathour9 (nginx-fo...@forum.nginx.org) wrote: I want to log all the headers in client browser send to nginx.However known header i can log.But I want to log the all unknown headers. How can i log unknown header in

Re: How to log all headers in nginx?

2017-06-06 Thread Zhang Chao
You can traverse the list r->headers_in.headers. On 7 June 2017 at 14:22:38, prathour9 (nginx-fo...@forum.nginx.org) wrote: I want to log all the headers in client browser send to nginx.However known header i can log.But I want to log the all unknown headers. How can i log unknown header in ngin

Re: Proxy parameter to nginx service

2017-06-05 Thread Zhang Chao
Hi I think it is tough by nguni itself, maybe you can use the ngx_lua, save the environment to Nginx variable, and use them in proxy_pass. On 5 June 2017 at 22:17:05, juan_barbancho_...@cajarural.com ( juan_barbancho_...@cajarural.com) wrote: Hi Guys, I need to use nginx to made a proxy_pass t

Re: Reverse proxy that forward requests to ALL upstream servers?

2017-06-04 Thread Zhang Chao
Hi! OpenResty is recommend in this case. You can combine it with the ngx_proxy module. On 4 June 2017 at 11:44:41, Yongtao You via nginx (nginx@nginx.org) wrote: Hi, I have a rather special requirement. I need to setup a reverse proxy with multiple upstream servers, and whenever a POST reque

Re: Same cached objects, but different body_bytes_sent

2017-06-03 Thread Zhang Chao
ed to return 499 in this case? Tks, Guilherme On Fri, Jun 2, 2017 at 3:45 AM, Zhang Chao wrote: > Hi! > > Are you sure the client didn't close the connection when the body is > transferring? > > > On 2 June 2017 at 10:00:36, Guilherme (guilherm...@gmail.com) wrote: > &g

Re: Same cached objects, but different body_bytes_sent

2017-06-01 Thread Zhang Chao
Hi! Are you sure the client didn't close the connection when the body is transferring? On 2 June 2017 at 10:00:36, Guilherme (guilherm...@gmail.com) wrote: I identified a strange behavior in my nginx/1.11.2. Same cached objects are returning different content length. In the logs below, body_byt

Re: why reuseport don't increases throughoutput?

2017-05-22 Thread Zhang Chao
Well, i think may be you need an off-cpu flame graph :) On 23 May 2017 at 10:59:29, fengx (nginx-fo...@forum.nginx.org) wrote: There should been no blocking operation. At least, we have the same codebase and same sample data in the two test cases. In fact, our application is based on OpenResty

Re: why reuseport don't increases throughoutput?

2017-05-22 Thread Zhang Chao
Hi! Just as the article says, it can also mean that when a worker is stalled by a blocking operation, the block affects not only connections that the worker has already accepted, but also connection requests that the kernel has ass

Re: why reuseport don't increases throughoutput?

2017-05-22 Thread Zhang Chao
Hi! Just as the article says, it can also mean that when a worker is stalled by a blocking operation, the block affects not only connections that the worker has already accepted, but also connection requests that the kernel has ass

Re: How can I set a maximum limit for gzip module?

2017-04-28 Thread Zhang Chao
Hi t.nishiyori, Don’t worry, just like Ermilov said, when you enable the gzip module and nginx gets a part of response body, gzip module will try to compress the data, and if the buffers reach the limit, gzip module just send these compressed data firstly(ngx_http_gzip_body_filter), when processin

Re: How can I set a maximum limit for gzip module?

2017-04-26 Thread Zhang Chao
There is no any directive like “gzip_max_length” so far. By the way, nginx compresses the body by “chunk”, so one “chunk” is an independtent compressed data. On 27 April 2017 at 13:27:42, t.nishiyori (nginx-fo...@forum.nginx.org) wrote: Hello, I'm using nginx-1.11.2 for proxy server with gzip-m

Re: access log request without query string

2017-04-19 Thread Zhang Chao
Maybe lua-nginx-module is more convenient :) On 20 April 2017 at 08:08:46, Frank Liu (gfrank...@gmail.com) wrote: Hi, What's the best way to login the original request uri ($request_uri) without query string? I tried $uri but it seems to be normalized and if I have customized 404 error page /40