公司原来的Mantis在个人的机器上,现在购置了服务器,迁移到Linux系统中,以下是手记
1.MySQL安装配置
1.1.安装
$sudo apt-get install mysql-server
1.2.配置
$mysql -uroot -p
输入root密码
建立用户
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.Nginx安装配置
2.1.安装最新版的
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
提示Ok
sudo vim /etc/apt/sources.list
加入nginx官方源
deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx
更新
sudo apt-get update
sudo apt-get install nginx
2.2.配置
因为各版本不同,请先
more /etc/nginx/nginx.conf看一下配置文件的位置
建立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/host.access.log main;
location / {
root /var/www/mantis;#这个位置是刚建立的
index index.php index.html index.htm;#加上了index.php,用空格分隔多个值
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
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 index.php;
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/init.d/nginx {start|stop|status|restart|reload|force-reload|upgrade|configtest}
3.PHP5-FPM安装,配置
参考文档
http://shen2.cn/2010/08/nginx-php5-fpm/
http://qlj.sh.cn/linux/20090815/nginx-php-no-input-file-specified/
http://rubyist-journal.com/2010/02/28/howto-nginx-php5-mysql-phpmyadmin-ubuntu-shortest-setup/
http://b.gkp.cc/2010/10/12/setup-nmp-on-ubuntu-1010/
3.1.安装
sudo vim /etc/apt/sources.list
加入非官方源
deb http://ppa.launchpad.net/jdub/devel/ubuntu maverick main
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
deb-src http://ppa.launchpad.net/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/test.php
输入
<?
phpinfo();
?>
http://192.168.1.250:8000/test.php
sudo vi /etc/php5/fpm/php.ini
设置(好象不改也没得事)
cgi.fix_pathinfo=0
3.3.管理
sudo service php5-fpm
Usage: /etc/init.d/php5-fpm {start|stop|force-quit|restart|reload}
4.Mantis安装和配置
把已有的matis代码传到/var/www/mantis
http://192.168.1.250/admin/install.php
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/test.php #去掉所有权限