diff --git a/Dockerfile b/Dockerfile index 3dcd06b..4eea309 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,4 +30,10 @@ RUN apt-get update && apt install -y openssl libssl-dev COPY --from=build /presence/target/release/presence . +EXPOSE 8080 + +# Create the directory for Let's Encrypt challenges +RUN mkdir -p /var/www/letsencrypt/.well-known/acme-challenge/ && \ + chown -R www-data:www-data /var/www/letsencrypt/ + CMD ["./presence"] diff --git a/nginx.conf.sigil b/nginx.conf.sigil index 4df3952..d1b1f97 100644 --- a/nginx.conf.sigil +++ b/nginx.conf.sigil @@ -45,6 +45,13 @@ server { {{ end }} # Default location block + + # Let's Encrypt ACME Challenge + location ^~ /.well-known/acme-challenge/ { + root /var/www/letsencrypt/; + try_files $uri =404; + } + location / { proxy_pass http://{{ $.APP }}-{{ $upstream_port }}; {{ $proxy_settings }} diff --git a/src/main.rs b/src/main.rs index a298cbd..5373fe8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ use actix_web::error::{ErrorUnauthorized, ErrorInternalServerError as ServerErro use std::sync::{Arc, Mutex}; use tokio::task::JoinHandle; + mod data; #[derive(Clone)] @@ -131,7 +132,7 @@ async fn main() -> std::io::Result<()> { .app_data(web::Data::new(state.clone())) .route("/", web::post().to(connect_handler)) }) - .bind("127.0.0.1:80")? + .bind("0.0.0.0:8080")? .run() .await }