![Ubuntu 16.04:nginx:[emerg] 零大小共享内存区域“一”](https://linux22.com/image/692359/Ubuntu%2016.04%EF%BC%9Anginx%EF%BC%9A%5Bemerg%5D%20%E9%9B%B6%E5%A4%A7%E5%B0%8F%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E5%8C%BA%E5%9F%9F%E2%80%9C%E4%B8%80%E2%80%9D.png)
我想在本地上传项目。当我尝试使用php-fpm
此行时,它不会重新加载,而是退出并显示错误fastcgi_pass unix:/run/php/php7.0-fpm.sock;
:。nginx
nginx: [emerg] zero size shared memory zone "one"
我该如何解决这个问题?我应该设置吗nginx_uploadprogress_module
?
我的配置文件:
server {
listen 80;
server_name demi-le.work;
# DDoS protection - allow up to 20 r/s peaks
limit_req zone=one burst=20;
root /home/demi/projects/demi-le.work/web;
#root /opt/sites/underconstruction;
index index.htm index.html index.php app-ind.php;
client_max_body_size 30m;
charset utf-8;
# Deliver static content
location /public {
# DDoS protection - allow up to 50 r/s peaks
#limit_req zone=one burst=50;
root /home/demi/projects/demi-le.work;
access_log off;
expires 300d;
}
# Security
location ~* \/public\/images\/.*\.php$ {
deny all;
}
# Deliver dynamic content
location ~ (\/public\/scripts.*\.php)(.*)$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/demi/projects/demi-le.work/$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $1;
fastcgi_param DOCUMENT_ROOT /home/demi/projects/demi-le.work; # this param required
#fastcgi_keep_conn on;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/demi/projects/demi-le.work/web$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /home/demi/projects/demi-le.work/web; # this param required
#fastcgi_keep_conn on;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location @php {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/demi/projects/demi-le.work/web/index.php;
#fastcgi_keep_conn on;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location / {
default_type text/html;
root /home/demi/projects/demi-le.work/web;
#root /opt/sites/underconstruction;
if (!-e $request_filename) {
return 404;
}
error_page 404 502 504 403 405 = @php;
}
# Redecalaring 502 error
error_page 502 = /502.html;
location = /502.html {
root /home/demi/projects/demi-le.work/web;
}
error_page 405 = @405;
location = @405 {
root /home/demi/projects/demi-le.work/web;
}
}
答案1
您正在使用limit_req zone=zonename burst=20;
,为了使限制发挥作用,我必须更改它:
limit_req_zone $http_x_forwarded_for zone=zonename:20m rate=100r/s; # you missed line like this
server {
.....
location /public {
limit_req zone=zonename nodelay;
.....
}
}
当然,请确保根据您的限制要求进行修改。