A simple static file http server
- Supports multiple paths mapping
- Supports angular router
- Supports custom index files
- Supports TLS (HTTPS)
- Supports basic authorize
- Supports compress
- Supports log file and colorful output
- Supports upload files
Current file path mapping to web root, default port is 8080.
./simplehttpserver
Browse http://localhost:8080
The dist
path mapping to web root, port to 4200, index file is index.html and supports fallback to index.html
./simplehttpserver -addr :4200 -path dist -indexnames index.html -fallback index.html
First, you can use mkcert to create the cert-files for develop.
mkcert -install
mkcert -cert-file ssl-cert.pem -key-file ssl-cert.key localhost 127.0.0.1 ::1
Then run command
./simplehttpserver -addrtls :8081 -certfile ssl-cert.pem -keyfile ssl-cert.key -username admin -password admin -logfile 1.log
Browse https://localhost:8081
-
Make a config file
./simplehttpserver -makeconfig config.yaml
-
Edit config.yaml
You can add multiple paths in the config file.
Line starts with
#
is a comment line.addr: 0.0.0.0:8080 #addrtls: 0.0.0.0:8081 #certfile: ./ssl-cert.pem #keyfile: ./ssl-cert.key #username: admin #password: admin compress: false paths: #/c: "C:\\" #/d: "D:\\" indexnames: - index.html - index.htm verbose: true enablecolor: true enableupload: true ## maxrequestbodysize 0 to default size maxrequestbodysize: 9223372036854775807 ## timeout 0s is no limit readtimeout: 0s writetimeout: 0s logfile: ./simplehttpserver.log #fallback: ./index.html #HTTP_PROXY: #HTTPS_PROXY: #NO_PROXY: ::1,127.0.0.1,localhost
-
Run with the config file
./simplehttpserver -config config.yaml
./simplehttpserver -help
bash ./build.sh
Powered by