This commit is contained in:
Untone 2023-10-12 18:11:16 +03:00
commit 2f5ef1dc93
3 changed files with 15 additions and 1 deletions

View File

@ -30,4 +30,10 @@ RUN apt-get update && apt install -y openssl libssl-dev
COPY --from=build /presence/target/release/presence . 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"] CMD ["./presence"]

View File

@ -45,6 +45,13 @@ server {
{{ end }} {{ end }}
# Default location block # Default location block
# Let's Encrypt ACME Challenge
location ^~ /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
try_files $uri =404;
}
location / { location / {
proxy_pass http://{{ $.APP }}-{{ $upstream_port }}; proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
{{ $proxy_settings }} {{ $proxy_settings }}

View File

@ -9,6 +9,7 @@ use actix_web::error::{ErrorUnauthorized, ErrorInternalServerError as ServerErro
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
mod data; mod data;
#[derive(Clone)] #[derive(Clone)]
@ -131,7 +132,7 @@ async fn main() -> std::io::Result<()> {
.app_data(web::Data::new(state.clone())) .app_data(web::Data::new(state.clone()))
.route("/", web::post().to(connect_handler)) .route("/", web::post().to(connect_handler))
}) })
.bind("127.0.0.1:80")? .bind("0.0.0.0:8080")?
.run() .run()
.await .await
} }