一,准备资料
1.mrbs源码下载“Meeting Room Booking System - Browse /mrbs/MRBS 1.11.5 at SourceForge.net”
2.window环境nginx服务下载(nginx-1.24.0.zip) nginx: download
3.php服务下载(php-8.3.10-nts-Win32-vs16-x86.zip) PHP For Windows: Binaries and sources Releases
4.mysql服务下载MySQL :: Download MySQL Community Server
二,软件安装配置
1.mrbs配置
(1)解压mrbs压缩包,mrbs/目录下可见“INSTALL”文件,描述了安装所需环境及一些会议系统配置信息,英文好的可直接参考该文件
(2)mrbs/web目录将config.inc.php-semp文件改为config.inc.php(mrbs执行调用配置文件),打开文件修改配置信息;注意:systemdefaults.inc.php&areadefaults.inc.php两个文件为基准配置文件,不可轻易修改,如有修改可拷贝至config.inc.php文件修改即可生效
(3)config.inc.php文件修改如下:
<?php // -*-mode: PHP; coding:utf-8;-*-
namespace MRBS;
use IntlDateFormatter;
require_once 'lib/autoload.inc';
/**************************************************************************
* MRBS Configuration File
* Configure this file for your site.
* You shouldn't have to modify anything outside this file.
*
* This file has already been populated with the minimum set of configuration
* variables that you will need to change to get your system up and running.
* If you want to change any of the other settings in systemdefaults.inc.php
* or areadefaults.inc.php, then copy the relevant lines into this file
* and edit them here. This file will override the default settings and
* when you upgrade to a new version of MRBS the config file is preserved.
*
* NOTE: if you include or require other files from this file, for example
* to store your database details in a separate location, then you should
* use an absolute and not a relative pathname.
**************************************************************************/
/**********
* Timezone
**********/
// The timezone your meeting rooms run in. It is especially important
// to set this if you're using PHP 5 on Linux. In this configuration
// if you don't, meetings in a different DST than you are currently
// in are offset by the DST offset incorrectly.
//
// Note that timezones can be set on a per-area basis, so strictly speaking this
// setting should be in areadefaults.inc.php, but as it is so important to set
// the right timezone it is included here.
//
// When upgrading an existing installation, this should be set to the
// timezone the web server runs in. See the INSTALL document for more information.
//
// A list of valid timezones can be found at http://php.net/manual/timezones.php
// The following line must be uncommented by removing the '//' at the beginning
$timezone = "Asia/Shanghai"; //修改时区,该参数必须,不写打开会议页面会有警告提醒
/*******************
* Database settings
******************/
// Which database system: "pgsql"=PostgreSQL, "mysql"=MySQL
$dbsys = "mysql"; //数据库,我使用的是MySQL数据库
// Hostname of database server. For pgsql, can use "" instead of localhost
// to use Unix Domain Sockets instead of TCP/IP. For mysql "localhost"
// tells the system to use Unix Domain Sockets, and $db_port will be ignored;
// if you want to force TCP connection you can use "127.0.0.1".
$db_host = "localhost"; //数据库地址,window下用localhost,我用IP地址导致连接失败
// If you need to use a non standard port for the database connection you
// can uncomment the following line and specify the port number
// $db_port = 1234;
// Database name:
$db_database = "mrbs"; //数据库名称,与MySQL中创建的数据库名称一致
// Schema name. This only applies to PostgreSQL and is only necessary if you have more
// than one schema in your database and also you are using the same MRBS table names in
// multiple schemas.
//$db_schema = "public";
// Database login user name:
$db_login = "root"; //数据库访问名
// Database login password:
$db_password = '*********'; //数据库访问密码
// Prefix for table names. This will allow multiple installations where only
// one database is available
$db_tbl_prefix = "mrbs_";
// Set $db_persist to TRUE to use PHP persistent (pooled) database connections. Note
// that persistent connections are not recommended unless your system suffers significant
// performance problems without them. They can cause problems with transactions and
// locks (see http://php.net/manual/en/features.persistent-connections.php) and although
// MRBS tries to avoid those problems, it is generally better not to use persistent
// connections if you can.
$db_persist = false;
/* Add lines from systemdefaults.inc.php and areadefaults.inc.php below here
to change the default configuration. Do _NOT_ modify systemdefaults.inc.php
or areadefaults.inc.php. */
// The company name is mandatory. It is used in the header and also for email notifications.
// The company logo, additional information and URL are all optional.
$mrbs_company = "你的会议室名称"; // This line must always be uncommented ($mrbs_company is used in various places)
$override_locale = 'zh-CN'; //中文简体,默认是英文
(4)其实我根据自己需求将会议类型进行了客制化,折腾了半天,改了源码,最后实现了80%;发现配置档可以直接进行配置,配置完成仅需在mrbs/web/lang/lang.zh-cn,新增类型即可(不想泄露信息,所以在此不贴修改,熟悉前端的一看便知);新增完成修改配置项,修改systemdefaults.inc.php(配置在config.inc.php应该也可以,大家可以试一下,我懒得试了;违背的不修改systemdefaults.inc.php文件的原则o(* ̄︶ ̄*)o)配置如下:
unset($booking_types); // Include this line when copying to config.inc.php
$booking_types[] = "E"; //系统默认
$booking_types[] = "I"; //系统默认
$booking_types[] = "G"; //新增
$booking_types[] = "H"; //新增
2.nginx服务配置
(1)将nginx压缩包,解压至你看着比较顺眼的位置
(2)修改nginx配置文件(D:\nginx\nginx-1.24.0\conf)
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80; #服务器监听端口
server_name 0.0.0.0; #域名,0.0.0.0允许所有外部用户访问
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
root E:/software/MRBS/mrbs/web; #mrbs index.php文件路径
index index.html index.htm index.php;
autoindex on; #充许列表目录
}
#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 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$ {
# root html;
#root E:/software/MRBS/mrbs/web;
fastcgi_pass 127.0.0.1:9000; #php服务信息
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME E:/software/MRBS/mrbs/web$fastcgi_script_name;
include fastcgi_params;
#fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
#client_max_body_size 2000M;
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
(3)nginx配置文件修改完成,进nginx文件路径(如果有条件将nginx加入环境变量更便捷)执行nginx -t 检查配置是否有误
(4)启动nginx服务 start nginx.exe
(5)查看nginx是否正常运行 tasklist | findstr nginx
(6)其他实用命令
nginx关闭:nginx -s quit
nginx重启:nginx -s reload
查看服务端口是否被占用:netstat -ano | findstr :80
命令添加环境变量:
setx PATH "%PATH%;C:\php"
查看环境变量:
echo %PATH%
3.php服务配置
(1)将php压缩包解压缩,我将解压文件拷贝至了C盘根目录,放其他盘应该也没问题
(2)修改配置文件,将php.ini-development文件改为php.ini
//配置文件内容太多,没有全部复制,仅把需要修改的参数列举如下:
extension_dir = "ext"
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
extension=mysqli
extension=intl
extension=pdo_mysql
(3)PHP运行有个大坑,在window下运行一段时间会挂掉;在此先不介绍服务启动方法,下面“疑难杂症”中会介绍启动方法
4.MySQL服务器部署及数据库创建
(1)解压缩MySQL压缩包
(2)在my.ini同级目录新建data文件夹
(3)修改mysql/my.ini配置文件(根据自己文件路径信息配置)
[mysqld]
port=3306
basedir=E:\\software\\MySQL\\mysql
datadir= E:\\software\\MySQL\\mysql\\data
max_connections=200
max_connect_errors=10
character-set-server=utf8mb4
default-storage-engine=INNODB
[mysql]
default-character-set=utf8mb4
[client]
port=3306
default-character-set=utf8mb4
(4)用压缩包方式安装,首先进入MySQL的文件目录(E:\software\MySQL\mysql\bin)执行初始化命令: mysqld.exe --initialize --user=mysql --console,安装完成如下图(一定要记录该数据库登录密码):
(5)执行MySQL服务安装命令:mysqld.exe –install
(6)启动数据库服务mysqld.exe --console
(7)登录数据库:mysql.exe -uroot -p
(8)修改数据库密码,进入数据库后执行命令ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘new_password’修改密码(mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘new_password’)
至此数据库创建完成,下一步开始建数据库,建mrbs数据表
(9)终端连接数据库,导入mrbs数据表
我用的是DBeaver数据库终端工具,连接成功后,传建数据库:
mrbs/路径找到tables.my.sql文件,DBeaver中打开SQL编辑器,并连接至mrbs数据库,将tables.my.sql中创建表的SQL语句,一个表一个表的拷贝的SQL编辑器,单个执行(DBeaver,批量执行会报错)
tables.my.sql中SQL全部执行完成,共新建9个表
关闭MySQL服务命令:mysqladmin.exe -u root -p 你的密码 shutdown
三,服务部署
第二步所有动作全部执行完成,按照上述命令启动所有服务,浏览器输入IP+端口号即可访问会议室预约系统,如下图示意
四,疑难杂症
在window环境下,PHP服务运行一段时间会自行挂掉,运行指令为:php-cgi.exe -b 127.0.0.1:9000 -c php.ini
解决办法:xxfpm
(1)下载xxfpm Gitee Search
根据gitee服务介绍,将xxfpmW文件copy至PHP文件根目录,xxfpmW配置文件采用默认值即可,然后直接运行 xxfpmW.vbe文件,运行成功可在任务管理器看到同时有五个FastCGI服务在运行
这样完美解决了PHP服务挂掉的问题。
(2)PHP服务关闭方法:
a.任务管理器中右键 Microsoft ® Windows Based Script Host 结束任务。
b.任务管理器中右键 xxfpmW.exe 结束任务。