搬瓦工VPS
Bandwagonhost

宝塔面板 BT.CN 常用命令大全

宝塔面板目前确实很火,发现很多很多站长都转移到宝塔门下。宝塔面板对于初学者确实很不错,自带图形界面,可视化的操作让新入门的网友也能使用的得心应手。虽然宝塔面板是可视化操作界面,难免我们还会用到 SSH 登录进行操作的时候,今天整理下 BT.CN 宝塔面板常用命令大全,为了自己以后使用,也为了大家在查阅宝塔命令时方便查找。

宝塔面板 BT.CN 常用命令大全

宝塔面板安装命令

Centos安装脚本
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
Ubuntu/Deepin安装脚本
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
Debian安装脚本
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
Fedora安装脚本
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh

宝塔面板管理命令

宝塔工具箱(包含下列绝大部分功能 直接ssh中执行bt命令 仅限6.x以上版本面板)
bt
停止
/etc/init.d/bt stop
启动
/etc/init.d/bt start
重启
/etc/init.d/bt restart
卸载
/etc/init.d/bt stop && chkconfig --del bt && rm -f /etc/init.d/bt && rm -rf /www/server/panel
查看当前面板端口
cat /www/server/panel/data/port.pl
修改面板端口,如要改成8881(centos 6 系统)
echo '8881' > /www/server/panel/data/port.pl && /etc/init.d/bt restart
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 8881 -j ACCEPT
service iptables save
service iptables restart

修改面板端口,如要改成8881(centos 7 系统)
echo '8881' > /www/server/panel/data/port.pl && /etc/init.d/bt restart
firewall-cmd --permanent --zone=public --add-port=8881/tcp
firewall-cmd --reload

强制修改MySQL管理(root)密码,如要改成123456
cd /www/server/panel && python tools.py root 123456
修改面板密码,如要改成123456
cd /www/server/panel && python tools.py panel 123456
查看宝塔日志
cat /tmp/panelBoot.pl
查看软件安装日志
cat /tmp/panelExec.log
站点配置文件位置
/www/server/panel/vhost
删除域名绑定面板
rm -f /www/server/panel/data/domain.conf
清理登陆限制
rm -f /www/server/panel/data/*.login
查看面板授权IP
cat /www/server/panel/data/limitip.conf
关闭访问限制
rm -f /www/server/panel/data/limitip.conf
查看许可域名
cat /www/server/panel/data/domain.conf
关闭面板SSL
rm -f /www/server/panel/data/ssl.pl && /etc/init.d/bt restart
查看面板错误日志
cat /tmp/panelBoot
查看数据库错误日志
cat /www/server/data/*.err
站点配置文件目录(nginx)
/www/server/panel/vhost/nginx
站点配置文件目录(apache)
/www/server/panel/vhost/apache
站点默认目录
/www/wwwroot
数据库备份目录
/www/backup/database
站点备份目录
/www/backup/site
站点日志
/www/wwwlogs

宝塔面板 Nginx 服务管理命令

nginx安装目录
/www/server/nginx
启动
/etc/init.d/nginx start
停止
/etc/init.d/nginx stop
重启
/etc/init.d/nginx restart
启载
/etc/init.d/nginx reload
nginx配置文件
/www/server/nginx/conf/nginx.conf

宝塔面板 Apache 服务管理命令

apache安装目录
/www/server/httpd
启动
/etc/init.d/httpd start
停止
/etc/init.d/httpd stop
重启
/etc/init.d/httpd restart
启载
/etc/init.d/httpd reload
apache配置文件
/www/server/apache/conf/httpd.conf

宝塔面板 MySQL 服务管理命令

mysql安装目录
/www/server/mysql
phpmyadmin安装目录
/www/server/phpmyadmin
数据存储目录
/www/server/data
启动
/etc/init.d/mysqld start
停止
/etc/init.d/mysqld stop
重启
/etc/init.d/mysqld restart
启载
/etc/init.d/mysqld reload
mysql配置文件
/etc/my.cnf

宝塔面板 FTP 服务管理命令

ftp安装目录
/www/server/pure-ftpd
启动
/etc/init.d/pure-ftpd start
停止
/etc/init.d/pure-ftpd stop
重启
/etc/init.d/pure-ftpd restart
ftp配置文件
/www/server/pure-ftpd/etc/pure-ftpd.conf

宝塔面板 PHP 服务管理命令

php安装目录
/www/server/php
启动(请根据安装PHP版本号做更改,例如:/etc/init.d/php-fpm-54 start)
/etc/init.d/php-fpm-{52|53|54|55|56|70|71|72|73|74} start
停止(请根据安装PHP版本号做更改,例如:/etc/init.d/php-fpm-54 stop)
/etc/init.d/php-fpm-{52|53|54|55|56|70|71|72|73|74} stop
重启(请根据安装PHP版本号做更改,例如:/etc/init.d/php-fpm-54 restart)
/etc/init.d/php-fpm-{52|53|54|55|56|70|71|72|73|74} restart
启载(请根据安装PHP版本号做更改,例如:/etc/init.d/php-fpm-54 reload)
/etc/init.d/php-fpm-{52|53|54|55|56|70|71|72|73|74} reload
配置文件(请根据安装PHP版本号做更改,例如:/www/server/php/52/etc/php.ini)
/www/server/php/{52|53|54|55|56|70|71|72|73|74}/etc/php.ini

宝塔面板 Redis 服务管理命令

redis安装目录
/www/server/redis
启动
/etc/init.d/redis start
停止
/etc/init.d/redis stop
redis配置文件
/www/server/redis/redis.conf

宝塔面板 Memcached 服务管理命令

memcached安装目录
/usr/local/memcached
启动
/etc/init.d/memcached start
停止
/etc/init.d/memcached stop
重启
/etc/init.d/memcached restart
启载
/etc/init.d/memcached reload

宝塔面板平滑升级命令

从5.9平滑升级到6.x

注意:

1、Centos6请勿执行此升级命令

2、升级过程耗时较长且可能会受网络因素影响导致升级失败

3、如果升级后无法正常启动面板,请重新执行升级命令

4、升级有一定的风险,生产环境请谨慎升级

curl -sSO http://download.bt.cn/install/update_to_6.sh && bash update_to_6.sh

5.x平滑升级到7.x命令

注意:

1、升级过程耗时较长且可能会受网络因素影响导致升级失败

2、如果升级后无法正常启动面板,请重新执行升级命令

3、升级有一定的风险,生产环境请谨慎升级

4、如果服务器有快照功能,一定要先打快照再升级
curl http://download.bt.cn/install/update_to_6.sh|bash

【常驻小尾巴】
无论本文聊的是 VPS、脚本还是一杯拿铁,我们都为折腾留了一个出口——
👥 搬瓦工中文网QQ交流群:238290124
一句话简介:技术闲聊、优惠爆料、翻车互助、红包随机掉落。
我们在这里等你一起把不可能变成日常。