nginx-module-stream-sts
nginx-module-stream-sts copied to clipboard
display_handler::shm_init() failed
OS: CentOS 6.9
Nginx info:
- 1.12.0
- build with dynamic module
- /usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so
- /usr/lib64/nginx/ngx_stream_server_traffic_status_module.so
--add-dynamic-module=nginx-module-sts-0.1.0 --add-dynamic-module=nginx-module-stream-sts-0.1.0
- order of load module
- check 3 case and get same results.
load_module "/usr/lib64/nginx/ngx_stream_module.so";
load_module "/usr/lib64/nginx/ngx_stream_server_traffic_status_module.so";
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";
or
load_module "/usr/lib64/nginx/ngx_stream_module.so";
load_module "/usr/lib64/nginx/ngx_stream_server_traffic_status_module.so";
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";
or
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";
nginx-module-stream-sts : 0.1.0 release version
nginx config:
load_module "/usr/lib64/nginx/ngx_http_geoip_module.so";
#load_module "/usr/lib64/nginx/ngx_http_image_filter_module.so";
#load_module "/usr/lib64/nginx/ngx_http_perl_module.so";
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";
#load_module "/usr/lib64/nginx/ngx_http_vhost_traffic_status_module.so";
#load_module "/usr/lib64/nginx/ngx_http_xslt_filter_module.so";
#load_module "/usr/lib64/nginx/ngx_mail_module.so";
#load_module "/usr/lib64/nginx/ngx_stream_module.so";
#load_module "/usr/lib64/nginx/ngx_stream_geoip_module.so";
#load_module "/usr/lib64/nginx/ngx_stream_server_traffic_status_module.so";
http {
...
stream_server_traffic_status on;
stream_server_traffic_status_zone;
...
server {
listen 80 default_server;
server_name _;
location / {
try_files $uri $uri/ =404;
root /usr/share/nginx/html;
index index.html index.php;
}
location ~ ^/(robots\.txt|favicon\.ico)($|/) {
log_not_found off;
access_log off;
}
localtion /status {
stream_server_traffic_status_display;
stream_server_traffic_status_display_format html;
}
# Error documents
location ~ /nginx-error/error.html {
internal;
alias /usr/share/nginx/html/error.html;
ssi on;
set $hstatus $args;
access_log off;
}
# Fancyindex
location /fancyindex/ {
alias /usr/share/nginx/fancyindex/;
}
#
# logging off
#
location = /robots.txt {
log_not_found off;
access_log off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ \.(dat|cfg|orig|org|bak|rpmsave|save|,v|tpl|la?ng|modules?|engines?|install|inc|ini|ph)$ {
deny all;
}
location ~ \.(htaccess|htgroup|htpasswd) {
deny all;
}
location ~ /(temp|sessions?|class(es)?)/ {
deny all;
}
}
}
And access http://domain.com/status, occurs follow error:
[error] 10391#0: *1 display_handler::shm_init() failed, client: 192.168.0.1, server: _, request: "GET /status HTTP/1.1", host: "domain.com"
Hi, Thanks for reporting.
Please make sure you use the server_traffic_status_zone
directive.
The directive server_traffic_status_zone
in stream block is essential because the shared memory zone using in nginx-module-sts, nginx-module-stream-sts is allocated by that directive.
The process finding shared memory zone is as follows:
- nginx-module-stream-sts ->
server_traffic_status_zone
-> Allocate shared memory zone - nginx-module-sts ->
stream_server_traffic_status_display
-> Find shared memory zone