Mantis 迁移手记(Ubuntu Server 10.04 + Nginx + PHP-FPM + Mantis 1.2.8)

时间:2025-03-24 09:06:08
建立用户
mysql>create user 'mantis'@'localhost' identified by 'mantis';
建表
mysql>create database mantis default character set=utf8;
授权
mysql>grant all privileges on mantis.* to 'mantis'@'localhost';
mysql>quit;
直接从现有的库导入数据
$mysqldump -h 192.168.1.117 -umantis -pmantis mantis | mysql -umantis -pmantis mantis;


安装配置
2.1.安装最新版的
wget /keys/nginx_signing.key
sudo apt-key add nginx_signing.key
提示Ok

sudo vim /etc/apt/
加入nginx官方源
deb /packages/ubuntu/ lucid nginx
deb-src /packages/ubuntu/ lucid nginx
更新
sudo apt-get update
sudo apt-get install nginx

2.2.配置
因为各版本不同,请先
more /etc/nginx/看一下配置文件的位置


建立mantis的目录
sudo mkdir -p /var/www/mantis


sudo vim /etc/nginx/nginx的配置文件位置
server {
    listen       8000;
    server_name  localhost 192.168.1.250; #可能要加域名,用空格分隔多个值


    #charset koi8-r;
    #access_log  /var/log/nginx/log/  main;


    location / {
        root   /var/www/mantis;#这个位置是刚建立的
        index   ;#加上了,用空格分隔多个值
    }

    #error_page  404              /;


    # redirect server error pages to the static page /
    #
    error_page   500 502 503 504  /;
    location = / {
        root   /usr/share/nginx/html;
    }


    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
#下面几行取消注释
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  ;
        fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name; #必须的,不然会出现No input file specified.
        include        fastcgi_params;
    }


    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

管理服务
sudo service nginx stauts
Usage: /etc//nginx {start|stop|status|restart|reload|force-reload|upgrade|configtest}




3.PHP5-FPM安装,配置
参考文档
/2010/08/nginx-php5-fpm/
/linux/20090815/nginx-php-no-input-file-specified/
/2010/02/28/howto-nginx-php5-mysql-phpmyadmin-ubuntu-shortest-setup/
/2010/10/12/setup-nmp-on-ubuntu-1010/


3.1.安装
sudo vim /etc/apt/
加入非官方源
deb /jdub/devel/ubuntu maverick main
deb /brianmercer/php/ubuntu lucid main
deb-src /brianmercer/php/ubuntu lucid main

更新
sudo apt-get update
sudo apt-get install php5-fpm php5-mysql
#sudo apt-get install php-apc php5-curl php5-gd php5-imagick php5-mysql php5-memcache php5-memcached php5-mcrypt


3.2.配置
测试安装是否成功
sudo vim /var/www/mantis/
输入
<?
phpinfo();
?>
http://192.168.1.250:8000/


sudo vi /etc/php5/fpm/
设置(好象不改也没得事)
cgi.fix_pathinfo=0 


3.3.管理
sudo service php5-fpm
Usage: /etc//php5-fpm {start|stop|force-quit|restart|reload}


安装和配置
把已有的matis代码传到/var/www/mantis
http://192.168.1.250/admin/
sudo vim config_inc.php #修改数据库连接,邮件SMTP,文件上传目录等
http://192.168.1.250/admin/ #查看安装结果


装完后:
sudo chmod -rwx /var/www/mantis/admin #去掉所有权限
sudo chmod -rwx /var/www/mantis/ #去掉所有权限