1.安装apache
查看是否安装过:rpm -qa |grep httpd
安装:yum install -y httpd
启动apache:systemctl start httpd
检查启动状态:systemctl status httpd
错误日志位置:/var/log/httpd/error_log
2.安装PHP
更新yum源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果是centos6,那么执行以下代码:
CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum安装php7.0
yum install php70w php70w-common php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-memcached php70w-devel php70w-cli
3.安装mantis
wget https://jaist.dl.sourceforge.net/project/mantisbt/mantis-stable/2.18.0/mantisbt-2.18.0.zip
unzip mantisbt-2.18.0.zip
mv mantisbt-2.18.0 /var/www/html/mantis
chown -R apache:apache /var/www/html/mantis/
重启apache:systemctl start httpd
访问http://ip:端口/mantis/ ,在web页面进行数据库配置
与MySQL8.0数据库不兼容问题
修改数据库配置文件:my.cnf
[mysqld]
default_authentication_plugin = mysql_native_password
重启数据库:service mysqld restart
文件上传配置
vim /var/www/html/mantis/config/config_inc.php
$g_allow_file_upload = ON;
$g_file_upload_method = DISK;
$g_allowed_files= 'txt,jpg,png,jepg,gif,bmp,zip,tar.gz,doc';
$g_absolute_path_default_upload_folder = '/var/www/html/mantis/upload';
$g_preview_p_w_uploads_inline_max_size = 99999999;
重启apache:systemctl restart httpd
但是上传文件时报错,打开浏览器控制台:
because it violates the following Content Security Policy directive: "img-src 'self'".
vim /var/www/html/mantis/core/http_api.php
使用#注释掉http_csp_add( 'img-src', "'self'" );