Hi guys
a novice here so go easy on me with this question:
having multiple 'listen' with IPs or, just one 'listen' with a hostname
which resolves to more than one IP - is it possible to tell Nginx not
fail when one of IPs is absent, does not exist?
many thanks, L.
Hello,
Is there a way to log individual websocket messages going through a nginx
server setup to proxy websocket as explained here
https://nginx.org/en/docs/http/websocket.html ?
-Chinmay
I had a wordpress blog and was working on Apache. I migrated the blog to
Nginx + php-fpm. But i have a problem with this.
My blog has RSS with example.com/feed URL , and i could see the feeds with
paged like this example -> http://www.kodcu.com/feed/?paged=45.
But in Nginx, this paged RSS urls dont work with my config. /feed and
/feed/?paged=X URLs shows top 10 content.
My nginx.conf same as below. How can i handle this problem?
user root root;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
error_log /var/log/nginx/error.log;
access_log off;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/html text/plain text/css application/json
application/x-javascript text/xml application/xml application/xml+rss
text/javascript;
##
# Virtual Host Configs
##
index index.php index.html index.htm;
## See here: http://wiki.nginx.org/WordPress
server {
server_name example.comwww.example.com;
root /var/www/example.com;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,238692,238692#msg-238692
Hi Everyone,
I compile nginx from source. When I use nchan-1.2.12 everything compiles
clean.
However I tried to upgrade to nchan-1.2.15 and I get a compilation error.
Google told me the same error was reported back in February.
My C skills are a forgotten week's course taken in the early 1990s, and
never used, so I don't have the skills to sort it out.
Could it be the version of gcc OR is it conflicting with openssl3.0.3,
pcre-8.45, or zlib-1.2.12?
Thanks for ideas. I would like to use the latest nchan.
Is it possible to use a pre-compiled version, and link dynamically?
O/S Ubunutu 20.04 and Ubuntu 22.04
Regards
Ian
--
Ian Hobson
Tel (+66) 626 544 695
I run a fleet of small- to medium-scale web apps on PHP, and I'm comfortable
compiling Nginx + PHP to to optimise for my needs. Until now, I've used
PHP-FPM exclusively. I have read about performance improvements with Nginx
Unit as far as PHP is concerned. This interests me, and I have time
available to learn.
My question - for anyone who's gone from PHP-FPM to Unit…was it worth it?
What advice would you give?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,294258,294258#msg-294258
Hi,
I am writing my own filter module based on the gzip filter module. My filter
module would first insert a long text (200 to 1024 KB based on the
situation) at the beginning of the original response and then do some other
manipulations to the original response. The pre-configured number of buffers
that can be allocated per request (like the gzip_buffers directive in gzip
filter module) will reduce the risk of OOM.
Here is the example code:
ngx_int_t rc;
ngx_chain_t *ch = NULL;
size_t len = 64 * 4096;
ngx_buf_t *b = ngx_create_temp_buf(r->pool, len);
if (b == NULL) {
return NGX_ERROR;
}
b->recycled = 1;
b->tag = (ngx_buf_tag_t) &ngx_http_my_filter_module;
// operation to copy 64 kb data to the ngx_buf_t b;
b->last = b->pos + len;
ch = ngx_alloc_chain_link(r->pool);
if (ch == NULL) {
goto failed;
}
ch->buf = b;
ch->next = NULL;
rc = ngx_http_next_body_filter(r, ch); // rc got NGX_OK
if (rc != NGX_OK && rc != NGX_AGAIN) {
goto failed;
}
ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &ch,
(ngx_buf_tag_t) &ngx_http_my_filter_module);
ngx_chain_t *cl = ch;
while (cl) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "buf sz: %z",
ngx_buf_size(cl->buf)); // output: buf sz: 65536
cl = cl->next;
}
// reuse the buffer b if possible
Explanation:
I created a buffer b with 64k, then I copied 64k data, then I called
ngx_http_next_body_filter to send the first 64k data to the client, then I
want to reuse the buffer b to send the next 64k data and so on.
The question is after ngx_http_next_body_filter, ctx->free is still NULL,
because ngx_buf_size(b) got 65536 which means that the buffer b cannot be
recycled. My guess even if the next_body_filter returns an NGX_OK, it
doesn't guarantee any of the buffers inside the ngx_chain_t can be reused.
What should I do if I want to reuse the 64k buffer?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,294374,294374#msg-294374
Hi Team,
Is it possible to pass lua variable in proxy pass directive which we define
using set_by_lua_file directive ?
Example :
set_by_lua_file $ref test.lua;
proxy_pass '$ref';
Below is lua code :
local function main()
local host="https://example.com"
return host
end
return main()
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,294355,294355#msg-294355
hello,
Just encounter this issue on the latest version of nginx 1.22.0.
Basically i added the "proxy_read_timeout 600s;" in a server directive and
run "nginx -s reload".
I was getting still "upstream timed out (110: Connection timed out) while
reading response header from upstream, client: " after 60 seconds which is
the default value.
Than i said, let's restart the whole service with systemctl restart nginx
and it worked..no more upstream timeout.
the whole config file:
----------------------------
server {
server_name blablaerp.com;
# modsecurity on;
client_max_body_size 100M;
location / {
proxy_pass https://172.20.14.172:443;
proxy_read_timeout 600s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
error_log /var/log/nginx/bcamprod_Errnginx.log;
access_log /var/log/nginx/bcamprod_Accessnginx.log;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/blablaerp.com/fullchain.pem; #
managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/blablaerp.com/privkey.pem; #
managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
#add_header X-Robots-Tag "all";
}
On Tue, 2022-05-31 at 00:01 +0000, nginx-request(a)nginx.org wrote:
Hi there,
> I've been trying to install Roundcube on my server, but when I get to
> the web installer (enter mail.example.com/installer in the address
bar
> of my browser) I consistently get 404. The webroot is
> /var/www/roundcube, and there's an installer directory under that
with
> an index file in it. I just can't figure out why it's misbehaving
(or,
> more accurately, what I haven't correctly told it to do).
Do the nginx logs indicate that the request got to nginx?
What is your nginx config, for this request?
These are the most recent entries in the nginx access log:
72.18.50.172 - - [30/May/2022:22:19:34 -0400] "GET /installer HTTP/2.0"
404 114 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101
Firefox/100.0"
72.18.50.172 - - [30/May/2022:22:19:34 -0400] "GET /favicon.ico
HTTP/2.0" 404 114 "https://grace.koalatyworks.com/installer"
"Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101
Firefox/100.0"
Do you mean the config file for Roundcube or a different config? Sorry
if I'm being dense, but I don't want to waste bandwidth with the wrong
file.
Ken
Hello,
I am using nginx/1.20.1 and i am still searching for solution for
configuring different ssl_protocol version for different vhosts. Currently
it is reasing the first vhost ssl setting and applied to all following
vhosts.
Anyone got any idea?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,294327,294327#msg-294327