禅道的nginx伪静态配置
公司最近把原来的redmine给淘汰了,启用了禅道这个项目管理软件,专业版居然要150元/人,真的好贵,很多地方的禅道nginx伪静态规则都不能使用,翻了好多blog终于找到个可以正常的,下面来看教程.
系统:centos 7.x(64位)
环境:lnmp
1.下载禅道软件并解压丢到nginx配置的web路径下
wget http://dl.cnezsoft.com/zentao/9.3.beta/ZenTaoPMS.9.3.beta.zip
unzip ZenTaoPMS.9.3.beta.zip
cd zentaopms
cp -R * /data/www/vhosts/cdao/
然后新安装禅道,如果已经安装过禅道那么这一步就可以忽略.
2.配置nginx伪静态规则
server {
listen 80;
server_name cdao.slogra.com;
root /data/www/vhosts/cdao/www;
index index.php index.htm index.html;
location / {
if (!-e $request_filename) {
rewrite /(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
location /favicon.ico {
access_log off;
}
}
3.修改禅道requestType为PATH_INFO
这里以我的配置为例,你们找自己的文件目录.
vi /data/www/vhosts/cdao/config/my.php
将
$config->requestType = 'GET';改为
$config->requestType = 'PATH_INFO';
最后就是重新加载nginx配置,然后在浏览器上访问就可以看到伪静态已经生效了.
ps:https://csharp.love/zentao_on_nginx.html


评论: