Ngrok Setting up boot from

Source: Internet
Author: User

The way to run Ngrok in the background is described in the previous article. And we use Ngrok a lot of time to want to boot up on their own, the method is as follows:


One, create a new startup script in the Ngrok program directory, for example:

Path=/usr/appdata/ngrok
nohup $path/ngrok-config $path/ngrok.cfg start http ssh

Path is the current directory

Start script to write background startup script, after the startup project according to their own needs to write


Second, make the Ngrok program into a system service

Create a new service item (Ngrok) under the/ETC/RC.D/INIT.D directory, as follows:

#!/bin/sh
#chkconfig: 2345
#description: Ngrok ngrok_path=/usr/appdata/ngrok case
"$"
	in Start)
		echo "Start Ngrok service ..."
		SH ${ngrok_path}/start.sh
		;;
	*)
	exit 1
	;;
Esac


Assigning permissions to the file 755

chmod 755 Ngrok


Third, registration Ngrok service from start

Chkconfig--add Ngrok

Test whether the service can start successfully

Service Ngrok Start

Check for self-initiated services

Chkconfig



OK, restart the server to verify it. Success



If you have a top-level domain name, you want to access the local project through your domain name, then first resolve your top-level domain name to the IP of the Ngrok server (the domain name needs to be recorded OH), and then perform Ngrok-config=ngrok.cfg-hostname xxx.xxx.xxx (Xxx.xxx.xxx is your custom top-level domain)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.