任务 旧指令 新指令 使某服务自动启动 chkconfig –level 3 httpd on systemctl enable httpd.service 使某服务不自动启动 chkconfig –level 3 httpd off systemctl disable httpd.service 检查服务状态 service httpd status systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active) 显示所有已启动的服务 chkconfig –list systemctl list-units –type=service 启动某服务 service httpd start systemctl start httpd.service 停止某服务 service httpd stop systemctl stop httpd.service 重启某服务 service httpd restart systemctl restart httpd.service
虽然ngrok很久没有更新了,但是目前还是比较好用的内网穿透利器,这里我就来介绍下如何在centos 7上搭建ngrok服务端和客户端 1、环境安装: yum -y install gcc golang wget 2、下载ngrok: cd /usr/local/ git clone https://github.com/dollarphper/ngrok.git cd ngrok/ 3、生成证书: openssl genrsa -out rootCA.key 2048 openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=ileiming.com" -days 5000 -out rootCA.pem openssl genrsa -out server.key 2048 openssl req -new -key server.key -subj "/CN=ileiming.com" -out server.csr openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 5000 4、拷贝证书: cp rootCA.pem assets/client/tls/ngrokroot.crt cp server.crt assets/server/tls/snakeoil.crt cp server.key assets/server/tls/snakeoil.key 5、生成服务端文件: make release-server 6、生成客户端文件: # linux: GOOS=linux GOARCH=amd64 make release-client # windows: GOOS=windows GOARCH=amd64 make release-client # mac GOOS=darwin GOARCH=amd64 make release-client 7、服务端启动脚本: vi /usr/local/sbin/ngrok.sh #!/bin/bash /usr/local/ngrok/bin/ngrokd -log="/var/log/ngrok/ngrok.log" -domain="ileiming.com" -httpAddr=:80 -httpsAddr=:443 -tunnelAddr=:4443 1> /dev/null 2> /var/log/ngrok/ngrok.log & echo $! > /var/run/ngrok.pid 8、服务端创建启动服务: [Unit] Description=ngrok After=network.target [Service]...