加大Nginx的 client_max_body_size :
client_max_body_size 256m;
加大Nginx的 client_max_body_size :
client_max_body_size 256m;
把server_names_hash_bucket_size改大点即可,可以改成64或128试下,放在http {}里
Syntax: | server_names_hash_bucket_size size; |
---|---|
Default: | server_names_hash_bucket_size 32|64|128; |
Context: | http |
Sets the bucket size for the server names hash tables. The default value depends on the size of the processor’s cache line. The details of setting up hash tables are provided in a separate document.
certbot renew
An unexpected error occurred:
ImportError: cannot import name constants
Please see the logfile ‘/tmp/tmpl4isIP/log’ for more details.
With the EPEL repository added to your CentOS installation, simply install the snapd package:
$ sudo yum install snapd
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
$ sudo systemctl enable --now snapd.socket
To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap
and /snap
:
$ sudo ln -s /var/lib/snapd/snap /snap
Remove certbot-auto and any Certbot OS packages
If you have any Certbot packages installed using an OS package manager like apt, dnf, or yum, you should remove them before installing the Certbot snap to ensure that when you run the command certbot the snap is used rather than the installation from your OS package manager. The exact command to do this depends on your OS, but common examples are sudo apt-get remove certbot,
sudo dnf remove certbot, or sudo yum remove certbot.
If you previously used Certbot through the certbot-auto script, you should also remove its installation by following the instructions here.
Install CertbotRun this command on the command line on the machine to install Certbot.
sudo snap install --classic certbot
Prepare the Certbot commandExecute the following instruction on the command line on the machine to ensure that the certbot command can be run.sudo
ln -s /snap/bin/certbot /usr/bin/certbot
Choose how you’d like to run Certbot
Either get and install your certificates…Run this command to get a certificate and have Certbot edit your Nginx configuration automatically to serve it, turning on HTTPS access in a single step.
sudo certbot --nginx
Or, just get a certificateIf you’re feeling more conservative and would like to make the changes to your Nginx configuration by hand, run this command.
sudo certbot certonly --nginx
Test automatic renewalThe Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration. You can test automatic renewal for your certificates by running this command:
sudo certbot renew --dry-run
The command to renew certbot is installed in one of the following locations:
client_header_timeout 7d;
client_body_timeout 7d;
send_timeout 7d;
fastcgi_connect_timeout 7d;
fastcgi_read_timeout 7d;
fastcgi_send_timeout 7d;
php-fpm 和 nginx 一样,内建了个状态页,可以通过该状态页了解监控 php-fpm 的状态。
1. 在 php 的安装目录下的 www.conf 中打开 pm.status_path 配置项。如:我的 php 安装目录为 /www/source/php,则 www.conf 文件位于 /www/source/php/etc/php-fpm.d/www.conf;将此文件中的 pm.status_path = /status 前的分号去掉,修改成如下:
默认情况下为 /status,当然你也可以改成 /phpfpm_status 等等。这里我修改成 bcstatus
特别说明:你的服务器配置文件不一定叫 www.conf ,请根据自己的配置设置;也可以直接把 pm.status_path = /bcstatus 添加到 php-fpm.conf 中,但是,一定要添加到 php-fpm.conf 文件中的最后,否则重启php-fpm时会出现以下错误:
[24-Mar-2017 16:18:44] ERROR: [/www/source/php/etc/php-fpm.conf:126] unknown entry 'pm.status_path' [24-Mar-2017 16:18:44] ERROR: failed to load configuration file '/www/source/php/etc/php-fpm.conf' [24-Mar-2017 16:18:44] ERROR: FPM initialization failed
2. nginx 配置
在 nginx 的配置文件中添加以下配置。
server { ...... # 在 server 中添加以下配置 location = /bcstatus { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; } ..... }
特别说明:这里的 location 最后用 = 号,如我的配置 location = /bcstatus ,因为 = 的优先级最高,如果匹配成功后,就不会再匹配其它选项了。
3、重启 nginx、php-fpm 使配置生效
# /etc/init.d/nginx restart # /etc/init.d/php-fpm restart
重启后用浏览器访问 http://你的域名/bcstatus 就可以看到效果,如:
pool – fpm池子名称,大多数为www process manager – 进程管理方式,值:static, dynamic or ondemand. dynamic start time – 启动日期,如果reload了php-fpm,时间会更新 start since – 运行时长 accepted conn – 当前池子接受的请求数 listen queue – 请求等待队列,如果这个值不为0,那么要增加FPM的进程数量 max listen queue – 请求等待队列最高的数量 listen queue len – socket等待队列长度 idle processes – 空闲进程数量 active processes – 活跃进程数量 total processes – 总进程数量 max active processes – 最大的活跃进程数量(FPM启动开始算) max children reached - 进程最大数量限制的次数,如果这个数量不为0,那说明你的最大进程数量太小了,请改大一点。 slow requests – 启用了php-fpm slow-log,缓慢请求的数量
php-fpm 状态页的显示效果,可以有 json、xml、html、full 四种,可以通过 GET 传参显示不同的效果。
1、json 格式
通过访问 http://你的域名/bcstatus?json 来显示 JSON 格式,如:
2、xml 格式
通过访问 http://你的域名/bcstatus?xml 来显示 JSON 格式,如:
3、html 格式
通过访问 http://你的域名/bcstatus?html 来显示 JSON 格式,如:
4、full 格式
通过访问 http://你的域名/bcstatus?full 来显示 JSON 格式,如:
5、full 显示项
pid – 进程PID,可以单独kill这个进程. state – 当前进程的状态 (Idle, Running, …) start time – 进程启动的日期 start since – 当前进程运行时长 requests – 当前进程处理了多少个请求 request duration – 请求时长(微妙) request method – 请求方法 (GET, POST, …) request URI – 请求URI content length – 请求内容长度 (仅用于 POST) user – 用户 (PHP_AUTH_USER) (or ‘-’ 如果没设置) script – PHP脚本 (or ‘-’ if not set) last request cpu – 最后一个请求CPU使用率。 last request memorythe - 上一个请求使用的内存
原文链接:https://blog.csdn.net/ffzhihua/article/details/88844259
🤣
<?php
//apache方法,需要关闭apache缓冲区
for($i=0;$i<1000;$i++){
echo $i;
ob_flush();//刷新PHP自身缓冲区
flush();//刷新(特指apache)web服务器的缓冲区,输出数据
sleep(1);
}
//nginx缓冲区
ob_end_clean(); // 关闭默认的缓冲区 ob_end_flush() 也可以
ob_implicit_flush(); // 打开绝对刷送
header('X-Accel-Buffering: no'); // 告诉nginx直接输出
# 以上3个一起组合即可实现直接输出
for($i=0;$i<1000;$i++){
echo $i;
sleep(1);
}
nginx超时配置参见:
感谢仙士可 http://www.php20.cn/article/159
Syntax: | client_max_body_size size; |
---|---|
Default: | client_max_body_size 1m; |
Context: | http , server , location |
post_max_size = 128M; php的post最大大小限制
upload_max_filesize = 128M; php的单个文件大小的限制
PHP里通常需要3者结合才能解除文件上传大小限制。
服务器启动的时候dns解析失败,host直接绑定域名是一个解决方案,但是这样不太好