我想在本地build立项目。 当我尝试使用php-fpm这一行fastcgi_pass unix:/run/php/php7.0-fpm.sock; 那么nginx不会重新加载,它退出的错误: nginx: [emerg] zero size shared memory zone "one" 。
我怎样才能决定这个问题? 我应该设置nginx_uploadprogress_module吗?
我的configuration文件:
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; } }
你正在使用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; ..... } }
当然,请确保您根据您的限制要求进行修改。