sspanel-mod-v3-uim 最新版详细搭建教程【前端】
环境配置
1. 先ssh到你的服务器,安装一下常用的软件包:
1 2 |
yum -y install wget git zsh tmux vim sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" |
这时候你就拥有了一个漂亮的shell了 : )
2. 开启一个tmux窗口,切换到zsh
1 2 |
tmux new -s xiaoweigod zsh |
3. 安装lnmp环境
1 |
wget http://soft.vpser.net/lnmp/lnmp1.5.tar.gz -cO lnmp1.5.tar.gz && tar zxf lnmp1.5.tar.gz && cd lnmp1.5 && ./install.sh lnmp |
分别选择:

安装大致需要
30-40分钟
,请耐心等待
4. 配置域名解析
以godaddy为例,登录后选择我的账户
–你的域名
–DNS
,添加一个@和www的A解析,指向你的服务器地址:


尝试ping一下这个域名,能ping出对应的地址表示解析成功(大约10分钟才能生效)

克隆源码,搭建网站
1. 等待lnmp一键脚本安装完成后,为下图所示:

2. 新建一个网站
执行如下命令建立一个网站:
1 |
lnmp vhost add |
3. 配置php和nginx
1 |
vim /usr/local/php/etc/php.ini |
vim的用法我这里就不教学了,自行百度。
搜索一下proc_
,可以找到disable_functions
,把里面的system
, proc_open
, proc_get_status
删掉。
1 |
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server |
继续配置nginx:
1 |
vim /usr/local/nginx/conf/fastcgi.conf |
把最后一行fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
删除掉。
接下来配置网站目录:
1 |
vim /usr/local/nginx/conf/vhost/你的域名.conf |
找到root /www/xxxx.xxx;在后面加上 /public,即: root /www/xxxx.xxx/public; 配置伪静态: 在access_log off上方加入如下内容:
1 2 3 |
location / { try_files $uri /index.php$is_args$args; } |
保存退出后,重启lnmp:
1 |
lnmp restart |
4. 克隆源码,安装网站环境
1 2 3 4 5 6 7 8 |
cd 你的网站目录 git clone -b dev https://github.com/Anankke/ss-panel-v3-mod_Uim.git tmp && mv tmp/.git . && rm -rf tmp && git reset --hard wget https://getcomposer.org/installer -O composer.phar php composer.phar php composer.phar install cd ../ chmod -R 755 你的网站目录 chown -R www:www 你的网站目录 |
php composer.phar install
可能会出现一些 WARNING,无视。chmod -R 755
和chown -R www:www
会出现.user.ini
无权限操作的错误,无视。
配置网站环境
1. 创建,导入数据库
1 2 3 4 5 6 7 |
cd 你的网站目录 mysql -uroot -p 输入你的mysql密码 <搭建lnmp环境中设置的> create database vpn; use vpn; source sql/glzjin_all.sql exit |
source 那一步会刷出大量的提示
2. 配置网站程序
1 2 3 |
cd 你的网站目录 cp config/.config.php.example config/.config.php vim config/.config.php |
这里有大量需要更改的内容,大家可以看着注释自己慢慢改,这里要改的是数据库的连接信息:
db_driver
:mysql不用动db_host
:数据库主机,localhost不用动db_database
:数据库名,改为vpndb_username
:数据库用户名为rootdb_password
:数据库密码
3. 创建管理员账号并同步用户
1 2 3 4 5 |
php xcat createAdmin php xcat syncusers php xcat initQQWry php xcat resetTraffic php xcat initdownload |
如报错,请检查
.config.php
中的数据库链接信息是否正确。
4. 配置定时任务
执行crontab -e
,加入以下内容:
1 2 3 4 |
30 22 * * * php /www/你的网站目录/xcat sendDiaryMail 0 0 * * * php -n /www/你的网站目录/xcat dailyjob */1 * * * * php /www/你的网站目录/xcat checkjob */1 * * * * php /www/你的网站目录/xcat syncnode |
如需自动备份,可加入:
1 |
0 */20 * * * php -n /www/你的网站目录/xcat backup |
如需财务报表,加入:
1 2 3 |
5 0 * * * php /www/你的网站目录/xcat sendFinanceMail_day 6 0 * * 0 php /www/你的网站目录/xcat sendFinanceMail_week 7 0 1 * * php /www/你的网站目录/xcat sendFinanceMail_month |
如需检测被墙,加入:
1 |
*/1 * * * * php /www/你的网站目录/xcat detectGFW |
tip: 可以执行
tail -f /var/log/cron
查看自动化任务的运行情况。
如果上述所有操作都没问题,打开首页你就可以看到自己的网站了。
其他
1. php开启500错误记录:
编辑: /usr/local/php/etc/php-fpm.conf
,在[www]
下面加入如下内容:
1 2 |
php_admin_value[error_log] = /usr/local/php/var/log/php_errors.log php_admin_flag[log_errors] = on |
创建错误文件日志:
1 2 |
touch /usr/local/php/var/log/php_errors.log && chown www:www /usr/local/php/var/log/php_errors.log systemctl restart php-fpm restart |
1 2 |
最后执行 tail -f /usr/local/php/var/log/php_errors.log就能看到错误日志了。 |