Answer the question
In order to leave comments, you need to log in
Why does nginx throw an error on reboot?
Good day!
I have this proxy file in /etc/nginx
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Host $host;
proxy_connect_timeout 10;
proxy_send_timeout 10;
proxy_read_timeout 10;
proxy_redirect off;
proxy_set_header Connection close;
proxy_pass_header Content-Type;
proxy_pass_header Content-Disposition;
proxy_pass_header Content-Length;
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;
client_max_body_size 50m;
limit_req_zone $binary_remote_addr zone=one:10m rate=25r/s;
limit_req zone=one burst=30;
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";
gzip_min_length 1100;
gzip_proxied any;
gzip_comp_level 4;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server {
listen 80;
server_name my-parkovka.ru www.my-parkovka.ru;
root /var/www/my-parkovka/;
index index.php index.html;
if ($host !~ ^(my-parkovka.ru|www.my-parkovka.ru)$ ) {
return 444;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen|pron|money|free|jwh|speed|test|cash|xxx) ){
return 403 ;
}
if ($http_user_agent ~* LWP::Simple|BBBike|wget|curl|msnbot|scrapbot) {
return 403;
}
location ~* ^(?!/phpmyadmin/).+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav| bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)$ {
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location / {
proxy_pass 127.0.0.1:8080/;
include /etc/nginx/proxy;
}
}
server {
listen 80;
server_name my-montaj.ru www.my-montaj.ru;
root /var/www/my-montaj/;
index index.php index.html;
if ($host !~ ^(my-montaj.ru|www.my-montaj.ru)$ ) {
return 444;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen|pron|money|free|jwh|speed|test|cash|xxx) ){
return 403 ;
}
if ($http_user_agent ~* LWP::Simple|BBBike|wget|curl|msnbot|scrapbot) {
return 403;
}
location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv| txt|xml|docx|xlsx|svg)$ {
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location / {
proxy_pass 127.0.0.1:8080/;
include /etc/nginx/proxy;
}
}
server {
listen 80;
server_name my-moika.ru www.my-moika.ru;
root /var/www/my-moika/;
index index.php index.html;
if ($host !~ ^(my-moika.ru|www.my-moika.ru)$ ) {
return 444;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen|pron|money|free|jwh|speed|test|cash|xxx) ){
return 403 ;
}
if ($http_user_agent ~* LWP::Simple|BBBike|wget|curl|msnbot|scrapbot) {
return 403;
}
location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv| txt|xml|docx|xlsx|svg)$ {
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location / {
proxy_pass 127.0.0.1:8080/;
include /etc/nginx/proxy;
}
}
}
# sudo service nginx restart
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
# systemctl status nginx.service
Jun 18 10:27:22 106071.local systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 18 10:27:22 106071.local nginx[9012]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
Jun 18 10:27:22 106071.local nginx[9012]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 18 10:27 :22 106071.local systemd[1]: nginx.service: Control process exited, code=exited status=1
Jun 18 10:27:22 106071.local systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jun 18 10:27:22 106071.local systemd[1]: nginx.service: Unit entered failed state.
Jun 18 10:27:22 106071.local systemd[1]: nginx.service: Failed with result 'exit-code'.
Answer the question
In order to leave comments, you need to log in
in the same place, in English and white, it says "could not build server_names_hash, you should increase server_names_hash_bucket_size: 32"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question