Suppose we have a custom domain name called pi.xtestgo.xyz, configured and ready to use with LocalXpose (see previous create custom domain), now it is time to use it on raspberry pi.
1. SSH into the raspberry pi
ssh pi@192.168.1.11
2. Download LocalXpose
wget https://api.localxpose.io/api/v2/downloads/loclx-linux-arm.zip
3. Unzip LocalXpose
unzip loclx-linux-arm.zip
5. Create a unit file
To keep LocalXpose running in the background and on boot, we need to create a unit file
nano localxpose.service
paste the following and save it
[Unit]
Description=localxpose
After=network-online.target
[Service]
ExecStart=/home/pi/loclx tunnel http --reserved-domain pi.xtestgo.xyz --to 8000
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target
Replace the domain and the port with yours.
6. Copy the service file to system directory
sudo cp localxpose.service /etc/systemd/system/
7. Reload the systemd manager
sudo systemctl daemon-reload
8. Login through the CLI
sudo ./loclx account login
will ask you to enter your access token which you can get from your dashboard https://localxpose.io/dashboard (opens in a new tab)
9. Enable the service to be run on boot
sudo systemctl enable localxpose.service
10. Run LocalXpose service
sudo systemctl start localxpose.service