nginx won't start after lets encrypt update - nginx

After updating y let's encrypt domain update, I can't start Nginx. I got a message :
nginx: [emerg] zero size shared memory zone "one".
I did not find any solution, did anyone solve it ?
I saw that this memory is used by my 4 workers, I added a proxy but my server still does not restart.
Thank you
user nginx;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1.2;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
#proxy
proxy_cache_path /var/nginx/cache levels=1:2 keys_zone=app_cache:10m max_size=5g inactive=45m use_temp_path=off;
}

Eventually I found this line in one of my config files and commented it :
# limit_req zone=one burst=1 nodelay;
Thank you Shawn
Jean

Related

Nginx doesn't proxy traffic

Could you please advice what is wrong with my Nginx configuration?
When I try "curl localhost:80" the response is the start nginx page, so it doesn't proxy traffic. I have checked the nginx documentation but I have no idea about this behavior. Have anybody an idea?
Here are the configuration files:
sites-enabled/default.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
set $ups tst;
proxy_pass http://$ups:8080/;
proxy_set_header Host $http_host;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
daemon off;
events {
worker_connections 768;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
include conf/upstream.conf;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
conf/upstream.conf
upstream tst {
server xxx.xxx.xxx.xxx;
server xxx.xxx.xxx.xxx;
}
Thanks in advance!

How to find the page nginx is serving

I have inherited an nginx instance. I am barely more than a newbie when it comes to nginx.
When I navigate to the IP address of the box "http://192.168.1.10" I get a custom page back created by the previous dev somehow.
The nginx.conf looks like this:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
The conf.d directory is empty.
The sites-enabled directory contains a link default which points to default in sites-enabled. Here is that file:
server {
location / {
proxy_pass http://localhost:3002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 80;
listen [::]:80;
}
I have looked in /var/www/html and found the default index.nginx-debian.html that is not the one being served.
So, my question is, where is the file I'm getting back being served from? I'm running on a ubuntu server distro.

How to remove header server nginx

Using ubuntu server 20.04, nginx version: nginx/1.17.10 (Ubuntu), localhost,
when I shut down my dot net application, "502 Bad Gateway" following by nginx appears ( version is hidden successfully). I did this to hide nginx:
sudo apt-get update -y
sudo apt-get install -y nginx-extras
sudo nano /etc/nginx/nginx.conf
http {
more_set_headers "Server: Your_New_Server_Name";
server_tokens off; }
sudo service nginx restart
Refrence
Even tried
more_clear_headers Server;
more_set_input_headers -r 'Server: howdy';
but still having problem. All the web suggest just the same way, but not working to me.
My currently nginx.conf :
user ehsan1362;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
server_tokens off;
# more_clear_headers Server;
#more_set_input_headers -r 'Server: howdy';
add_header X-Frame-Options "SAMEORIGIN";
server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/proxy.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

uWSGI + nginx: request hangs if Content-Length specified

I am trying to set up a really simple uWSGI + nginx project.
I ran into the following problems
wsgi.input appears to be empty (which I found out trying to get
POST variables)
curl http://localhost:8080/parsings works fine, but curl http://localhost:8080/parsings --header "Content-Length:1" hangs and then returns curl: (52) Empty reply from server
Nothing appears on nginx error.log. uWSGI does not log anything either. It looks as if the request does not go anywhere near the server.
Here are the configs
nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_connect_timeout 10;
proxy_send_timeout 15;
proxy_read_timeout 20;
}
sites-enabled/mysite
server {
listen 127.0.0.1:8080;
server_name myproject.local;
client_max_body_size 2M;
location / {
include uwsgi_params;
uwsgi_read_timeout 300;
uwsgi_pass unix:///tmp/my_project.sock;
}
}
uwsgi.ini
[uwsgi]
module = wsgi:application
master = true
processes = 5
static-map = /static/=/home/breln/projects/myproject/static
socket = /tmp/my_project.sock
chmod-socket = 777
chown-socket = www-data
vacuum = true
die-on-term = true
Nginx is 1.11.8 (same problem appeared with 1.10.2). uWSGI is 2.0.14
Any hints appreciated.
Probably related to uWSGI not buffering/reading the POST data from Nginx, unless your WSGI app tries to use the POST data in the request handler:
Nginx connection reset, response from uWsgi lost

How to enable nginx status page?

I need the IP/nginx_status page for my check_nginx_status Nagios plugin. I followed some instructions:
nginx -V | grep --color -o http_stub_status #some HttpStubStatusModule verification
In nginx.conf, I added:
http {
...
server{
location /nginx_status {
stub_status on;
access_log off;
allow MY_IP;
deny all;
}
}
...
}
After nginx reload, the page should be available.
But, I get "The page you were looking for doesn't exist."
I have nginx v1.6.0.
nginx.conf:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
server {
listen 80;
location /nginx_status {
stub_status on;
access_log off;
#allow 107.170.106.199;
#deny all;
}
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

Resources