解决方法:
打开nginx主配置文件nginx.conf,找到http{}段,添加
client_max_body_size 20m;
http {
……
client_max_body_size 20m; #新增
}
解决方法:
打开nginx主配置文件nginx.conf,找到http{}段,添加
client_max_body_size 20m;
http {
……
client_max_body_size 20m; #新增
}
今天检查机器运行情况的时候在日志里看到这么一条:
2017/02/14 11:25:05 [warn] 32254#32254: *34 an upstream response is buffered to a temporary file /var/cache/nginx/fastcgi_temp/3/00/0000000003 while reading upstream, client: 66.249.73.253, server: www.on0926.com, request: "GET /?p=418 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "***.**.***"
在网上查了之后,都说是缓存问题,于是在主机的配置文件添加如下字段:
vim /etc/nginx/conf.d/****.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_buffer_size 512k;
fastcgi_buffers 6 512k;
fastcgi_busy_buffers_size 512k;
fastcgi_temp_file_write_size 512k;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /******/$fastcgi_script_name;
include fastcgi_params;
1. 修改注册表 在“开始→运行”中键入“regedit.exe”,打开“注册表编辑器”,展开分支“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services”
2. 在右侧窗格中显示的就是本机安装的服务项。
3.如果要新建服务,只须点击“编辑→新建→项”,然后为此项命名,如“test”;然后右击该项,选择“新建→字符串值”或“新建→DWORD值”即可。添加一个服务项目具体需要添加的键值如下: “DisplayName”,字符串值,
对应服务名称; “Description”,字符串值,对应服务描述;
“ImagePath”,字符串值,对应该服务程序所在的路径; “ObjectName”,
字符串值,值为“LocalSystem”,表示本地登录;
“ErrorControl”,DWORD值,值为“1”; “Start”,DWORD值,值为2表示自动运行,值为3表示手动运行,值为4表示禁止;
“Type”,DWORD值,应用程序对应10,其它对应20。
另外,还要在“test”项下新建一个“Enum”项。
按照以上步骤添加QQ程序为服务,重新启动计算机后,打开“服务”窗口,就可以看到刚才添加的QQ服务。 如果要删除某项服务,只要删除注册表的中相关键值即可,
本例中要删除QQ服务,直接删除“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\test”分支即可
1. 当前nginx的版本
[root@localhost ~]# nginx -v nginx version: nginx/1.10.3
2. 查看nginx 目录结构
[root@localhost ~]# cd /etc/nginx/ [root@localhost nginx]# tree ../nginx ../nginx ├── conf.d │ ├── default.conf │ └── default.conf.rpmsave ├── fastcgi_params ├── koi-utf ├── koi-win ├── mime.types ├── modules -> ../../usr/lib64/nginx/modules ├── nginx.conf ├── scgi_params ├── uwsgi_params └── win-utf
3.检查/etc/nginx/nginx.conf配置文件,确保文件中有:include /etc/nginx/conf.d/*.conf; 例如:
[root@localhost nginx]# cat nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
4. 在目录/etc/nginx/conf.d/下面新建文件conf文件,文件名可以任意写,自己看明白就OK,但是后缀名为.conf。
第一个,默认的为default.conf,我们让默认的使用80端口
[root@localhost nginx]# cat conf.d/default.conf server { listen 80; server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /data/www/blog; #网站根目录
index index.php index.html index.htm; #支持的index的类型
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/www/blog; #错误目录
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/blog/$fastcgi_script_name; #根目录+$fastcgi_script_name
include fastcgi_params;
}
# deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
#location ~ /\.ht {
# deny all;
#}
}
然后我们可以cp一个,并且命名为其他的名字如:
cp default.conf test.conf
然后再次编辑test.conf 修改主目录,监听的端口等。
然后保存配置,重启nginx
service nginx restart
参考地址:
http://blog.openlg.net/index.php/archives/266
https://ninghao.net/blog/1368
在更新系统的软件包时,发现如下错误:
[root@www]# yum -y update Loaded plugins: fastestmirror Setting up Update Process Determining fastest mirrors . . . Error: Package: util-linux-ng-2.17.2-12.24.el6_8.1.x86_64 (updates) Requires: kernel >= 2.6.32-642 Installed: kernel-2.6.32-279.el6.x86_64 (@anaconda-CentOS-201207061011.x86_64/6.3) kernel = 2.6.32-279.el6 kernel = 2.6.32-279.el6 Installed: kernel-2.6.32-358.6.2.el6.x86_64 (installed) kernel = 2.6.32-358.6.2.el6 kernel = 2.6.32-358.6.2.el6 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
根据提示,此次更新需要内核版本为2.6.32-642
而我有的版本为2.6.32-279 和2.6.32-358
不满足可以升级的要求,需要升级内核,但是升级内核具有很大的风险.
先做好快照。
接着我在网上找到这么一篇文章:
https://help.aliyun.com/knowledge_detail/38049.html
快速浏览的一遍,开始照做。
1、导入public key
rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2、安装elrepo到内核为2.6.32的CentOS中
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
3、安装kernel-lt(long term support)长期支持版本
yum –enablerepo=elrepo-kernel install kernel-lt -y
注:
1)
如果直接通过yum方式使用elrepo源速度会较慢(该源在国外)。
推荐采用rpm的方式安装kernel-lt:
访问http://elrepo.org/linux/kernel/el6/x86_64/RPMS/下载对应的rpm包,通过rpm方式安装:
rpm -ivh kernel-lt-3.10.93-1.el6.elrepo.x86_64.rpm
2)
关于kernel-lt的介绍可以参考elrepo官网介绍:http://elrepo.org/tiki/kernel-lt
4、编辑grub.conf文件,修改Grub引导顺序
vim /etc/grub.conf
确认安装的新内核的位置,将default的值调整为新内核的顺序,如本次升级案例中新装的内核位置为0,所以将default修改为0,保存退出,reboot重启服务器。