Tag Archives: rewrite

nginx的rewrite

设置nginx的rewrite如果替换项是以http://开头,则起的是redirect的作用,即使最后的参数是last不是redirect,例如: rewrite ^(.*)$ http://aaa.bbb.com/ccc$1 last; 浏览器端会得到302。 nginx的文档里提到: redirect – returns temporary redirect with code 302; it is used if the substituting line begins with http:// 另外,rewrite后的host的使用顺序如下: 当请求的http头里的host匹配sever_name里的任一host时,使用此host 若不匹配,或者为空,使用server_name的第一个host 若没有设置server_name,则使用本机的hostname 若要一直使用http头里的host,则将server_name设置为:servername _ *;(下划线不能少,因为 * 不能做为sever_name第一项的开头)

Posted in nginx, 运维 | Tagged , | Leave a comment

redmine vs trac

以下介绍仅限于两者初级试用阶段 trac基于python,有easy_install的话安装很简单,然而配置起来比较复杂,项目管理和用户权限控制等都要基于命令行,本土化工作也比较落后,不过插件很多,相关的功能比较完善 redmine和trac很像,基于ror,使用gem安装也很简单,配置全部可以在web界面搞定,本土化工作很不错,不过插件很少,有一些小的bug(主要集中在ajax上),svn的代码高亮很简陋,相关高亮插件有诡异的问题,具体表现是在 一些机器上只有在服务端第一次启动的时候高亮正常,其余情况下均产生错误的html页面。 redmine的一些注意事项: 使用mod_rails(passenger)或者直接运行内置服务器比较高效,fastcgi反应比较慢 使用fastcgi的话,注意要打开apache的rewrite模块,同时public目录下.htaccess设置RewriteBase,然后删掉除了fcgi的部分,不然会出循环rewrite的错误,类似这样:Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace. 如果ruby、apache(apxs)均为自己编译,安装mod_rails的时候要注意将ruby加到PATH中,然后export APXS2指向apxs,同时软连接一个rake到ruby的bin目录(没找到哪个环境变量能起作用,不得不说mod_rails的安装脚本虽然用户体验很好,但是比较弱智……) 使用mod_rails要在VirtualHost中设置RailsEnv production(请自行修改),同时注意加上Order

Posted in 应用 | Tagged , , , , , , | Leave a comment