Basic usage

Run it

You can simply run it and it will start from the current working directory on port 8000.

$ goshs
INFO   [2024-07-04 18:01:46] Download embedded file at: /example.txt?embedded 
INFO   [2024-07-04 18:01:46] Serving on interface lo bound to 127.0.0.1:8000 
INFO   [2024-07-04 18:01:46] Serving on interface eth0 bound to 10.137.0.27:8000 
INFO   [2024-07-04 18:01:46] Serving HTTP from /home/user 

Port

To change the port you use -p.

$ goshs -p 8080
INFO   [2024-07-04 18:01:46] Download embedded file at: /example.txt?embedded 
INFO   [2024-07-04 18:01:46] Serving on interface lo bound to 127.0.0.1:8080 
INFO   [2024-07-04 18:01:46] Serving on interface eth0 bound to 10.137.0.27:8080 
INFO   [2024-07-04 18:01:46] Serving HTTP from /home/user       

IP

You can choose to run it listening on a specific ip address or interface using -i.

$ goshs -i 127.0.0.1
INFO   [2024-07-04 18:01:46] Download embedded file at: /example.txt?embedded 
INFO   [2024-07-04 18:01:46] Serving on 127.0.0.1:8000                    
INFO   [2024-07-04 18:01:46] Serving HTTP from /home/user                 

$ goshs -i eth0
INFO   [2024-07-04 18:01:46] Download embedded file at: /example.txt?embedded 
INFO   [2024-07-04 18:01:46] Serving on 10.137.0.27:8000                  
INFO   [2024-07-04 18:01:46] Serving HTTP from /home/user                 

Directory

You can start it from different directory using -d.

$ goshs -d /tmp
INFO   [2024-07-04 18:01:46] Download embedded file at: /example.txt?embedded 
INFO   [2024-07-04 18:01:46] Serving on interface lo bound to 127.0.0.1:8000 
INFO   [2024-07-04 18:01:46] Serving on interface eth0 bound to 10.137.0.27:8000 
INFO   [2024-07-04 18:01:46] Serving HTTP from /tmp

Drop user privileges

You can start goshs on a privileged port as an administrative user, but drop the user privileges afterwards, to not expose a web server as root user.

$ sudo goshs -p 80 -u user
INFO   [2024-07-04 18:01:46] Download embedded file at: /example.txt?embedded 
INFO   [2024-07-04 18:01:46] Serving on interface lo bound to 127.0.0.1:80 
INFO   [2024-07-04 18:01:46] Serving on interface eth0 bound to 10.137.0.27:80 
INFO   [2024-07-04 18:01:46] Serving HTTP from /home/user                 
INFO   [2024-07-04 18:01:46] Dropping privileges to user 'user'           

$ ps aux | grep goshs
root       35975  0.0  0.0  10828  5028 pts/0    S+   11:56   0:00 sudo ./goshs -p 80 --u user
user       35976  0.0  0.1 1166136 8460 pts/0    Sl+  11:56   0:00 ./goshs -p 80 --u user

Update the binary

To update the binary you simply run goshs --update