mysql 的 information_schema 库

https://dev.mysql.com/doc/refman/5.7/en/information-schema.html

利用  information_schema 可以做很多事,这个库存储了mysql的元数据!

比如:

1)查询存在哪些 表是 innodb 的

2)查询 innodb 表的大小

3)查询某字段的定义

例子
SELECT table_schema,table_name, table_rows,
ROUND((data_length+index_length)/1024/1024) AS total_mb,
ROUND(data_length/1024/1024) AS data_mb,
ROUND(index_length/1024/1024) AS index_mb
FROM INFORMATION_SCHEMA.TABLES WHERE engine=’InnoDB’
ORDER BY total_mb desc;

php的win版本的一点编译解释

和本文一样的内容 是 这里

vc09 = Visual Studio 2008
vc10 = Visual Studio 2010
vc11 = Visual Studio 2012 2012
vc12 = Visual Studio 2013 2013
vc14 = Visual Studio 2015 2015
vc15 = Visual Studio 2017

VC11, VC14 & VC15
More recent versions of PHP are built with VC11, VC14 or VC15 (Visual Studio 2012, 2015 or 2017 compiler respectively) and include improvements in performance and stability.

– The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed

– The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed

– The VC15 builds require to have the Visual C++ Redistributable for Visual Studio 2017 x64 or x86 installed

TS and NTS
TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).

Posted in PHP

nginx 的ssl ,单ip多名ssl,以及方便脚本

首先,nginx 单ip多域名的ssl配置,参考地址是

单ip nginx配置多域名https

另外,利用 脚本可以比较方便的使用 lets-encrypt 提供的免费ssl,

https://github.com/xdtianyu/scripts/tree/master/lets-encrypt

一个配置文件的例子  letsencrypt.conf-myssl

ACCOUNT_KEY=”letsencrypt-account.key”
DOMAIN_KEY=”/www/ssl/myssldomain.com.key”
DOMAIN_DIR=” /www/myssldomain”
DOMAINS=”DNS:myssldomain.com,DNS:www.myssldomain.com”

方法就是配置 conf文件,然后运行就好了,

letsencrypt.sh   letsencrypt.conf-myssl

上面脚本就能自动帮你做注册和生成key的动作。后面只需要修改nginx的配置文件即可

nginx的配置文件,这样写

server
{
listen 80;
listen 443;
if ($scheme = http) {return 301 https://$server_name$request_uri;}
server_name www.myssldomain.com myssldomain.com;
root /www/myssldomain/;
index index.php index.html;
include php.conf;
ssl on;
ssl_certificate “/www/ssl/myssldomain.chained.crt”;
### 注意这里,最好用chained.crt 容易被多数浏览器支持
ssl_certificate_key “/www/ssl/myssldomain.com.key”;
}

 

wdcp的apache编译ssl模块

下载apache的源文件 http://archive.apache.org/dist/httpd/

解压后进入 modules/ssl 运行下面语句

/www/wdlinux/apache/bin/apxs -a -i -DHAVE_OPENSSL=1 -I/usr/include/openssl -L/usr/lib64/openssl -c *.c -lcrypto -lssl -ldl

下面的3行不一定对。一般来说编辑 conf/extra/httpd-ssl.conf 里面启用 https比较好

下面3行仅供参考:

SSLCertficateChainFile /www/wdlinux/apache/conf/1_root_bundle.crt
SSLCertificateFile /www/wdlinux/apache/conf/2_www.域名.com.crt
SSLCertificateKeyFile /www/wdlinux/apache/conf/3_www.域名.com.key

PS:

http 80 转向到 https 443

.htaccess里面

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://www.yourname.com%{REQUEST_URI} [L,R=301]
</IfModule>

dedecms重整dede_arctiny表

症状: dede:list 标签出现混淆,一些分类的文章没有显示,原因是删除文章的时候只删除了dede_archives 表,而dede_arctiny表没做相应的删除行,你会发现有些文章id在dede_arctiny表里依然存在,而dedecms原本为了加快速度的dede_arctiny表反而导致了错误。

select id from dede_arctiny where not exists(select * from dede_archives where dede_arctiny.id=dede_archives.id);

这个语句就可以看出来存在于dede_arctiny表里的多余数据,但是并不保证缺失数据

删除dede_arctiny里面的无效数据的sql语句为

delete from dede_arctiny where not exists(select * from dede_archives where dede_arctiny.id=dede_archives.id);

================================================================

下面是我们写的查缺补漏的全部重新生成最新鲜数据dede_arciny表的方法:

dedecms 织梦的dede_arctiny表的重整

truncate table `dede_arctiny`;
insert into `dede_arctiny`(`id`,`typeid`,`typeid2`,`arcrank`,`channel`,`senddate`,`sortrank`,`mid`) select `id`,`typeid`,`typeid2`,`arcrank`,`channel`,`senddate`,`sortrank`,`mid` from `dede_archives` where `arcrank` > -1 order by `id` asc ;

极路由开启访客网络后有线DHCP是访客的,而且上不了网

昨日开启极路由访客网络测试,手机正常,但是发现连接到极路由的pc网卡在重启后也获得了访客网络的dhcp分配的ip地址,并非原来 192.168.199.X,而是 192.168.200.X,网关 192.168.200.1,那么问题来了,上不了网了,无奈手动指定ip地址为 192.168.199.X 网关 192.168.199.1 后恢复上网。

此问题提交极路由bug

apache 2.4的Substitute模块使用注意

apache 2.4 的 Substitute 模块是个好东西,可以用来实时修改页面内容,做些替换什么的工作,比如

ProxyPass /  http://other_web_site.com
ProxyPassReverse / http://other_web_site.com
AddOutputFilterByType SUBSTITUTE text/html
Substitute “s|http://other_web_site.com|http://localhost|i”

可以把网页里面的 http://other_web_site.com 字样替换为 http://localhost

那么有时候 你会发现这个没生效,没法替换,但是这也没什么错误啊,
其实问题很可能是因为你proxy的那个站点用来压缩,导致在Substitute看起来页面是压缩的内容,他当然替换不了,那么必须在压缩前进行解压缩,其实并不需要解压,只需要告诉对方的服务器,我这里不接受压缩的文件,那么就需要另外一个模块了
LoadModule headers_module modules/mod_headers.so

这个模块可以更改proxy模块发到对方的header
RequestHeader set Accept-Encoding “”

那么完整就可以可以这样写

ProxyPass /  http://other_web_site.com
ProxyPassReverse /   http://other_web_site.com
RequestHeader set Accept-Encoding ""
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|http://other_web_site.com|http://localhost|i"

一共需要启用如下模块

LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule substitute_module modules/mod_substitute.so

 

附:有关nginx里面proxy的时候碰到gzip

看这里  http://www.zjpro.com/nginx-substitutions4nginx.html

 

Linux配置了vpn的ppp,访问百度速度慢或者无法访问

RT,搭设了 VPN,可以访问谷歌 FB等,现在却无法访问百度以及亚马逊,这真的很奇怪,有朋友也遇到相同的问题吗?着急求解!!

下载 ip-up-local,上传到服务器的 /etc/ppp/ip-up.local 文件,然后重启ppp服务

service pptpd stop && service pptpd start

参考资料来自

http://www.iyunv.com/thread-27228-1-1.html

Windows2008+IIS7.5出现FastCGI进程最近常常失败。请过一会再尝试此请求的解决方法

错误摘要
HTTP 错误 500.0 – Internal Server Error
FastCGI 进程最近常常失败。请过一会再尝试此请求

详细错误信息
模块 FastCgiModule
通知 ExecuteRequestHandler
处理程序 PHP for FastCgi
错误代码 0x80004005

修改FastCGI参数配置,将每分钟快速故障数设置为0即可解决该问题。

参考 http://piaoyun.cc/814.html

nginx配置防盗链的方法

nginx里面,防盗链需要针对你的域名和泛域名做相应的开放,所有图中 *.domain.com 是必须的,否则你的类似 www.domain.com 也会在屏蔽之列了

location ~* \.(gif|jpg|jpeg|png|bmp|swf|flv)$
{
valid_referers none blocked domain.com *.domain.com baidu.com *.baidu.com ;
if ($invalid_referer) {
return 403;
}
}

nginx的高性能参数配置

1)nginx.conf 里面的参数配置,假设服务器8核心(逻辑核心)

worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 102400;
events
{
use epoll;
worker_connections 204800;
accept_mutex on;
}

2) /etc/rc.local

echo “ulimit -SHn 65535” >> /etc/rc.local

3)/etc/security/limits.conf

* soft nofile 655360
* hard nofile 655360

4) /etc/sysctl.conf

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65000

 

参考文件:

http://www.open-open.com/lib/view/open1392942521299.html

 

iis 7.5 rewrite web.config

根据USER_AGENT和域名条件来转向

<rule name="Social Rewrite" patternSyntax="ECMAScript" stopProcessing="true">
 <match url="(.*)" ignoreCase="true" negate="false" />
 <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
 <add input="{HTTP_USER_AGENT}" pattern="字符串" />
 <add input="{HTTP_HOST}" pattern="^www\.domain1\.com$" />
 </conditions>
 <action type="Redirect" url="http://www.domain2.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
 </rule>

重要地方

logicalGrouping="MatchAll" 表示全部符合才行,类似条件的串联 AND
logicalGrouping="MatchAny" 表示符合其一就可以,类似条件的并联 OR

apt.sw.be失效 导致wdcp安装出错

修改 /etc/yum.repos.d/rpmforge.repo

### Name: RPMforge RPM Repository for RHEL 5 to 6 - dag
### URL: http://rpmforge.net/
### MODIFIED BY QQ733905
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = https://mirrors.tuna.tsinghua.edu.cn/repoforge/redhat/el$releasever/en/$basearch/rpmforge/
mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 0

大淘客cms增强版

增强版本增强功能:
1)多级cache,缓解大量文件在cache目录下的列表困难
2)增加远程服务器状态检测,当远程服务器无法获取数据,自动从本地缓存获取老数据,如果没有老数据就显示默认页面

dataokecms1
dataokecms2