A bare minimum web server that only serves static files over the internet
git clone https://github.com/junekimdev/gostaticserver.git staticserver
cd staticserver
mkdir public
This will build an executable file in the working directory
go build -o main
This will build a docker image
# shortest
make
# Same as above
make build
# Without cache
make bf
go run ./main.go
./main
make up
- Create a directory named
public
in the working directory - Put files in
./public
files in
./public
can be accessed viahttps://mydomain.com/myfile.ext
- Create directories in
./public
- Add files in the created directory
files in
./public/mydir
can be accessed viahttps://mydomain.com/mydir/myfile.ext
index.html
in the said directory
index.html
in./public/mydir
will be accessed viahttps://mydomain.com/mydir
If client tries to access a file that is not in the server, the server will return 404