Skip to content

hydrozoa-yt/simple-jetty-example-tls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a simple example webserver written using java 20, using Jetty embedded server (version 11).

This should be a good starting point for implementing a webservice in java.

Features:

  • HTTPS, with TLS certificates loading from res/self_signed.keystore
  • Serves directory /.well-known/acme-challenge/ to complete acme-challenge with webroot approach (to avoid downtime running certbot in standalone).
  • Builds with maven and stages distribution in dis/ with compile-distribution.ps1
  • Blazingly fast

How to run

  1. Build with maven
  2. Inside res/ run keytool -genkey -keyalg RSA -alias self_signed -keystore self_signed.keystore -storepass my_password123 -dname "CN=127.0.0.1" -noprompt in order to get a keystore
  3. Run Main.java

How to deploy

  1. Build with maven
  2. Run compile-distribution.ps1
  3. Copy your keystore to dis/webapp/res/
  4. Copy dis/webapp/ to your production server
  5. Run simple-jetty-example-tls.jar in your preferred way (could be systemd)
  6. (Optional) Configure nginx to expose your service to the internet trough port 443
  7. (Optional) Replace keystore with one generated using certificates from certbot and letsencrypt

License

You can do with this as you want.

About

Simple webservice using jetty and supporting tls.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published