1. 安装 Nginx
2. 安装 PHP7.2
CentOS 7下yum安装PHP版本默认是5.4的,禅道要求PHP版本7.0/7.1/7.2,所以把PHP升级一下
2.1 查看yum的可安装的php版本列表
yum provides php
2.2 更新PHP源
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum remove php-common -y
yum install -y php72w php72w-opcache php72w-xml php72w-mcrypt php72w-gd php72w-devel php72w-mysql php72w-intl php72w-mbstring
2.3 查看版本
php -v
2.4 安装php-fpm
yum install php72w-fpm
systemctl start php-fpm 【启动】
systemctl enable php-fpm【开机自启动】
# 查看php状态
ps -ef|grep php
ps1:php默认端口是9000,若端口已被占用,需要修改
修改php-fpm默认配置:/etc/php-fpm.d/www.conf
修改php默认端口
ps2:SELinux状态也会影响php-fpm启动,可以查看状态
命令:/usr/sbin/sestatus
若SELinux status: enabled,将SELINUX=enforcing 修改为 SELINUX=disabled 状态,如下:
vi /etc/selinux/config
# 修改下面
#SELINUX=enforcing
SELINUX=disabled
3. Nginx关联PHP配置
修改/usr/local/nginx/conf/nginx.conf
3.1 设置nginx线程数
# 根据cpu核心数来设定,一般为核心数倍数,我电脑4核
worker_processes 4;
3.2 pid 位置
pid conf/nginx.pid;
3.3 关联PHP
以修改80server为例
server {
listen 80;
server_name localhost;
location / {
root /opt/zentao/www;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /opt/zentao/www;
fastcgi_pass 127.0.0.1:9900;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
ps:在/opt/zentao/www目录下新建test.php,内容:
phpinfo()
?>
就可以http://192.168.2.50/test.php来访问了
4. 源码安装禅道
4.1 下载禅道开源版 的源码版本
下载地址
4.2 上传服务器/opt目录下(坑,其他目录报错)
unzip ZenTao*****.zip
# 修改文件夹名字为zentao
chmod -R 777 zentao
4.3 访问http://ip:port/install.php进行安装
5. 将禅道做二级目录访问
用地址http://ip:port/zentao/www/index.php来访问,对应的server配置如下
server {
listen 8000;
server_name 192.168.2.100;
location /zentao {
root /opt;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /opt;
fastcgi_pass 127.0.0.1:9900;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
这样就可以http://192.168.2.100:8000/zentao/www/index.php来访问禅道了。