2021年8月11日星期三

Linux常用服务运行管理命令

常用服务运行管理命令

systemctl daemon-reload                     更新配置
systemctl list-units --type=service       查看所有已启动服务状态

Apache2运行管理

sudo apachectl configtest #测试语法#
systemctl reload apache2 #重启#
systemctl status apache2 #查看状态#
a2ensite default-ssl.conf  #开启default-ssl.conf配置文件#
a2disconf default-ssl.conf #关闭default-ssl.conf配置文件#

Nginx的运行管理

nginx -t                               #检查语法#
nginx -s reload                    #重新加载配置并重启#
重启服务:
systemctl restart nginx #重启服务#或
/etc/init.d/nginx restart #重启服务#
systemctl status nginx #查看状态#

nginx.pid” failed 修复:
/usr/sbin/nginx -c /etc/nginx/nginx.conf

frpc

sudo systemctl enable frpc #开机启动#
sudo systemctl start frpc #启动#
systemctl status frpc #查看状态#
systemctl stop frpc  #停止
systemctl restart frpc #重启#
systemctl disable frpc #禁止开机启动#
frps
sudo systemctl enable frps #开机启动#
sudo systemctl start frps #启动#
systemctl status frps #查看状态#
systemctl stop frps  #停止
systemctl restart frps #重启#
systemctl disable frps #禁止开机启动#
godns
sudo systemctl enable godns #开机启动#
sudo systemctl start godns #启动#
systemctl status godns #查看状态#
systemctl stop godns  #停止
systemctl restart godns #重启#
systemctl disable godns #禁止开机启动#

快捷路径建立:

mkdir /usr/local/app
mkdir /usr/local/app/config
ln -s /etc/systemd/system /usr/local/app/config/systemd
ln -s /etc/samba /usr/local/app/config/samba
ln -s /etc/nginx /usr/local/app/config/nginx
ln -s /etc/apache2 /usr/local/app/config/apache2
ln -s /usr/local/app/config /root
ln -s /usr/local/app /root/config
ln -s /usr/lib/systemd/system/nginx.service    /etc/systemd/system/nginx.service
ln -s /lib/systemd/system/rc-local.service    /etc/systemd/system/rc-local.service