Localtunnel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(24 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <syntaxhighlight lang="bash"> | ||
source ~/.nvm/nvm.sh && nvm use node | source ~/.nvm/nvm.sh && nvm use node | ||
npm install -g localtunnel | npm install -g localtunnel | ||
</ | </syntaxhighlight> | ||
==Linux Service== | ==Linux Service== | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
cat << EOF | sudo tee /etc/systemd/system/academia-lt.service | cat << EOF | sudo tee /etc/systemd/system/chorke-academia-lt.service >/dev/null | ||
[Unit] | [Unit] | ||
Description=Academia Localtunnel Daemon | Description=Chorke Academia Localtunnel Daemon | ||
After=syslog.target network.target | After=syslog.target network.target | ||
Line 17: | Line 17: | ||
Type=simple | Type=simple | ||
Restart=on-failure | Restart=on-failure | ||
ExecStart=lt - | ExecStart=lt -p 80 -s chorke-academia | ||
TimeoutStopSec=20 | TimeoutStopSec=20 | ||
KillMode=process | KillMode=process | ||
Line 25: | Line 25: | ||
EOF | EOF | ||
</ | </syntaxhighlight> | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
sudo systemctl daemon-reload | sudo systemctl daemon-reload | ||
sudo systemctl enable --now academia-lt | sudo systemctl enable --now chorke-academia-lt | ||
systemctl status academia-lt | systemctl status chorke-academia-lt | ||
sudo systemctl disable --now academia-lt | sudo systemctl disable --now chorke-academia-lt | ||
systemctl status academia-lt | systemctl status chorke-academia-lt | ||
sudo systemctl restart academia-lt | sudo systemctl restart chorke-academia-lt | ||
systemctl status academia-lt | systemctl status chorke-academia-lt | ||
sudo systemctl stop academia-lt | sudo systemctl stop chorke-academia-lt | ||
systemctl status academia-lt | systemctl status chorke-academia-lt | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
Line 53: | Line 53: | ||
|- | |- | ||
| valign="top" colspan="2" | | | valign="top" colspan="2" | | ||
open https://academia | <syntaxhighlight lang="bash"> | ||
# nginx virtual host & reverse proxy config | |||
cat << EOF | sudo tee /etc/nginx/sites-enabled/chorke-academia.loca.lt >/dev/null | |||
server { | |||
listen 2015; | |||
listen [::]:2015; | |||
index index.html; | |||
server_name chorke-academia.loca.lt; | |||
root /var/www/chorke-academia.loca.lt; | |||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||
proxy_set_header X-Forwarded-Proto $scheme; | |||
proxy_set_header Host $http_host; | |||
proxy_redirect off; | |||
location / { | |||
proxy_pass http://127.0.0.1:3002; | |||
try_files $uri $uri/ =404; | |||
} | |||
location /api { | |||
proxy_pass http://127.0.0.1:3001; | |||
} | |||
access_log /var/log/nginx/chorke-academia.loca.lt/access.log; | |||
error_log /var/log/nginx/chorke-academia.loca.lt/error.log info; | |||
error_page 500 502 503 504 /500.html; | |||
client_max_body_size 25M; | |||
keepalive_timeout 10; | |||
} | |||
EOF | |||
</syntaxhighlight> | |||
|- | |||
| colspan="2" | | |||
---- | |||
|- | |||
| valign="top" colspan="2" | | |||
<syntaxhighlight lang="bash"> | |||
# haproxy frontend and backend config | |||
: <<'EOC' | |||
frontend chorke | |||
bind *:80 | |||
mode http | |||
acl host-is-chorke-academia hdr(host) -i chorke-academia.loca.lt | |||
use_backend chorke-academia if host-is-chorke-academia | |||
backend chorke-academia | |||
server nginx 127.0.0.1:2015 | |||
mode http | |||
EOC | |||
</syntaxhighlight> | |||
|- | |||
| colspan="2" | | |||
---- | |||
|- | |||
| valign="top" colspan="2" | | |||
'''Note:''' | |||
No need to update any '''/etc/hosts''' entries | |||
open https://chorke-academia.loca.lt &>/dev/null & | |||
open https://loca.lt/mytunnelpassword &>/dev/null & | open https://loca.lt/mytunnelpassword &>/dev/null & | ||
open https://ipv4.icanhazip.com &>/dev/null & | |||
|} | |||
==Playground== | |||
{| | |||
| valign="top" | | |||
lt --host 127.0.0.1 --port 80 --subdomain academia-chorke | |||
lt --port 80 --subdomain academia-chorke | |||
| valign="top" | | |||
lt -h 127.0.0.1 -p 80 -s academia-chorke | |||
lt -p 80 -s academia-chorke | |||
|- | |||
|colspan='2'| | |||
---- | |||
|- | |||
| valign="top" | | |||
curl -k https://loca.lt/mytunnelpassword | |||
curl -k https://ipv4.icanhazip.com | |||
sudo nginx -t | |||
| valign="top" | | |||
sudo rm /etc/systemd/system/academia-lt.service | |||
systemctl daemon-reload | |||
systemctl reset-failed | |||
|- | |||
|colspan='2'| | |||
---- | |||
|- | |||
| valign="top" | | |||
sudo ufw allow 9000:9010/tcp | |||
sudo systemctl status ufw | |||
sudo ufw status numbered | |||
| valign="top" | | |||
sudo ufw status verbose | |||
sudo ufw enable | |||
sudo ufw status | |||
|- | |||
|colspan='2'| | |||
---- | |||
|- | |||
| valign="top" | | |||
curl -k host.docker.internal:9000 | |||
curl -k host.docker.internal:9001 | |||
curl -k host.docker.internal:9002 | |||
| valign="top" | | |||
curl -k host.docker.internal:9008 | |||
curl -k host.docker.internal:9009 | |||
curl -k host.docker.internal:9010 | |||
|- | |||
|colspan='2'| | |||
---- | |||
|- | |||
| valign="top" | | |||
systemctl list-units --type=service --state=running | |||
systemctl list-units --type=service --state=active | |||
systemctl list-units --type=service | |||
| valign="top" | | |||
systemctl --type=service --state=running | |||
systemctl --type=service --state=active | |||
systemctl --type=service | |||
|- | |||
|colspan='2'| | |||
---- | |||
|- | |||
| valign="top" | | |||
firewall-cmd --list-services | |||
netstat -ltup | |||
| valign="top" | | |||
firewall-cmd --list-ports | |||
ss -ltup | |||
|} | |} | ||
Line 77: | Line 222: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
* [https://superuser.com/questions/513159/ Systemd » Safe Remove Services] | |||
* [[Apache/Proxy]] | * [[Apache/Proxy]] | ||
* [[OpenVPN]] | * [[OpenVPN]] | ||
* [[HAProxy]] | * [[HAProxy]] | ||
* [[Nashorn]] | * [[Nashorn]] | ||
* [[Hadoop]] | |||
* [[Nginx]] | * [[Nginx]] | ||
* [[Spark]] | |||
* [[Rhino]] | * [[Rhino]] | ||
* [[ExtJS]] | * [[ExtJS]] | ||
| valign="top" | | | valign="top" | | ||
* [[Academia JavaEE Workspace in Ubuntu]] | |||
* [[Linux Virtual Display for iPad Pro]] | |||
* [https://askubuntu.com/questions/7099/ UFW » Allow a Range of Ports] | |||
* [https://www.cloudflare.com/products/tunnel/ Tunnel » Cloudflare] | |||
* [https://dashboard.ngrok.com/tunnels/agents Tunnel » Ngrok] | |||
* [[PostgreSQL]] | |||
* [[ActiveMQ]] | |||
* [[NodeJS]] | |||
| valign="top" | | | valign="top" | | ||
|} | |} |
Latest revision as of 19:21, 16 September 2024
source ~/.nvm/nvm.sh && nvm use node
npm install -g localtunnel
Linux Service
cat << EOF | sudo tee /etc/systemd/system/chorke-academia-lt.service >/dev/null
[Unit]
Description=Chorke Academia Localtunnel Daemon
After=syslog.target network.target
[Service]
User=${USER}
Type=simple
Restart=on-failure
ExecStart=lt -p 80 -s chorke-academia
TimeoutStopSec=20
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
|
sudo systemctl daemon-reload
sudo systemctl enable --now chorke-academia-lt
systemctl status chorke-academia-lt
sudo systemctl disable --now chorke-academia-lt
systemctl status chorke-academia-lt
sudo systemctl restart chorke-academia-lt
systemctl status chorke-academia-lt
sudo systemctl stop chorke-academia-lt
systemctl status chorke-academia-lt
|
| |
# nginx virtual host & reverse proxy config
cat << EOF | sudo tee /etc/nginx/sites-enabled/chorke-academia.loca.lt >/dev/null
server {
listen 2015;
listen [::]:2015;
index index.html;
server_name chorke-academia.loca.lt;
root /var/www/chorke-academia.loca.lt;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
location / {
proxy_pass http://127.0.0.1:3002;
try_files $uri $uri/ =404;
}
location /api {
proxy_pass http://127.0.0.1:3001;
}
access_log /var/log/nginx/chorke-academia.loca.lt/access.log;
error_log /var/log/nginx/chorke-academia.loca.lt/error.log info;
error_page 500 502 503 504 /500.html;
client_max_body_size 25M;
keepalive_timeout 10;
}
EOF
| |
| |
# haproxy frontend and backend config
: <<'EOC'
frontend chorke
bind *:80
mode http
acl host-is-chorke-academia hdr(host) -i chorke-academia.loca.lt
use_backend chorke-academia if host-is-chorke-academia
backend chorke-academia
server nginx 127.0.0.1:2015
mode http
EOC
| |
| |
Note: No need to update any /etc/hosts entries open https://chorke-academia.loca.lt &>/dev/null & open https://loca.lt/mytunnelpassword &>/dev/null & open https://ipv4.icanhazip.com &>/dev/null & |
Playground
lt --host 127.0.0.1 --port 80 --subdomain academia-chorke lt --port 80 --subdomain academia-chorke |
lt -h 127.0.0.1 -p 80 -s academia-chorke lt -p 80 -s academia-chorke |
| |
curl -k https://loca.lt/mytunnelpassword curl -k https://ipv4.icanhazip.com sudo nginx -t |
sudo rm /etc/systemd/system/academia-lt.service systemctl daemon-reload systemctl reset-failed |
| |
sudo ufw allow 9000:9010/tcp sudo systemctl status ufw sudo ufw status numbered |
sudo ufw status verbose sudo ufw enable sudo ufw status |
| |
curl -k host.docker.internal:9000 curl -k host.docker.internal:9001 curl -k host.docker.internal:9002 |
curl -k host.docker.internal:9008 curl -k host.docker.internal:9009 curl -k host.docker.internal:9010 |
| |
systemctl list-units --type=service --state=running systemctl list-units --type=service --state=active systemctl list-units --type=service |
systemctl --type=service --state=running systemctl --type=service --state=active systemctl --type=service |
| |
firewall-cmd --list-services netstat -ltup |
firewall-cmd --list-ports ss -ltup |
References
| ||