Posts Tagged ‘nginx’

php-fpm报错

[ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool ‘default’
安装完php-cgi 不能启动
[ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool ‘default’
出现些错误提示,请修改 php-fpm.conf,将注释去掉
Unix user of processes

Read the rest of this entry »

apache rewrite转nginx–对大括号(花括号)的支持

在nginx中这样写规则
rewrite [\w]{5,20} /index.php last; 是无法启动的
解决的办法是加上两个双引号
rewrite “[\w]{5,20}” /index.php last; 这样就OK了
应该可以说是完全兼容apache的语法的,只需要改下RewriteRule为Rewrite,后面的
的这样对应改
[R] -> redirect;
[P] -> last;
[R,L] -> redirect;
[P,L] -> last;
[PT,L] -> last;
nginx rewrite中支持4种类型的转向:
跳转型的
redirect:302跳转到rewrite后的地址
permanent:301永久定向到rewrite后的地址,对搜索引擎更友好
代理型的
last:重新将rewrite后的地址在server标签中执行
break:将rewrite后的地址在当前location标签中执行

Read the rest of this entry »

duplicate MIME type “text/html” in nginx.conf

把nginx升级到最新以后,发现用原来的配置启动的时候会提示:
Starting nginx: [warn]: duplicate MIME type “text/html” in /usr/local/nginx/conf/nginx.conf:23
那一行的配置类似的是:
gzip_types  text/plain text/html  text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
实际上,text/html根本就不需要写的,gzip默认就会压缩它的,只不过以前的nginx版本不提示这个警告而已,新版本的会出这个警告,所以解决办法很简单:
把text/html从你的配置中拿开,呵呵。

Read the rest of this entry »