公司原來的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 #去掉所有許可權