Why after running tmux on a remote server via ssh, program works; but after detaching sessions, it returns 404?
In other words the behavior of the app changes by disconnecting from ssh terminal.
This is a Go(golang) program, a http server listening on a port, behind a nginx reverse proxy.
First data: everything works fine like this:
1 - I connect to the server using ssh user@server-ip
,
2 - run tmux
,
3 - run this script inside tmux
session, by . my-script.sh
:
#!/bin/sh
go build -v
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/tmp/myapi.log 2>&1
export API_COUCHDB_ADMIN='admin'
export API_COUCHDB_PASSWORD='************'
export API_COUCHDB_URL='http://172.17.0.2:5984/'
# [some other env variables ...]
./myapi
4 - detach the tmux session by Ctrl-b and then d.
So far so good! Everything works fine inside a browser on address http://www.myapi-consumer.com
and the ssh terminal is still open; but
5 - when I detach the ssh session (by Ctrl+a and d), the program no longer works correctly and returns 404 (it's the one sending 404).
6 - Now when I reconnect to the remote server using ssh user@server-ip
then again it works as expected and I am testing the "working" part on another connection - on my cell phone with another internet connection.
What is happening?