From a7aa60b4b7d547166382c2b26ab72049d67a5a5f Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Wed, 26 Feb 2025 19:51:28 +0100 Subject: [PATCH] Improve deployment config wip --- nginx.conf => deploy/nginx.conf | 11 +++++++++-- deploy/touch-programming.service | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) rename nginx.conf => deploy/nginx.conf (71%) create mode 100644 deploy/touch-programming.service diff --git a/nginx.conf b/deploy/nginx.conf similarity index 71% rename from nginx.conf rename to deploy/nginx.conf index 9c2d204..68c10ba 100644 --- a/nginx.conf +++ b/deploy/nginx.conf @@ -5,8 +5,9 @@ http { default_type application/octet-stream; server { + listen 80; + server_name touch-programming.hazemkrimi.tech; access_log /var/log/nginx/access.log; - root /usr/share/nginx/html; location / { @@ -17,8 +18,14 @@ http { try_files $uri =404; } + location ~* \.(?:css|js|ico|ttf|png|svg|webm) { + expires 1M; + access_log off; + add_header Cache-Control "public"; + } + location /api/ { - proxy_pass http://localhost:8080/; + proxy_pass http://127.0.0.1:5000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/deploy/touch-programming.service b/deploy/touch-programming.service new file mode 100644 index 0000000..c16178f --- /dev/null +++ b/deploy/touch-programming.service @@ -0,0 +1,19 @@ +[Unit] +Description=Touch Programming API Service + +[Service] +ExecStart=/usr/local/bin/touch-programming-api +WorkingDirectory=/usr/local/bin +User=hazem +Group=hazem +LimitNOFILE=65536 +Restart=on-failure +TimeoutSec=30 +PrivateTmp=true +ProtectSystem=full +ProtectHome=yes +NoNewPrivileges=true +AmbientCapabilities=CAP_NET_BIND_SERVICE + +[Install] +WantedBy=multi-user.target