diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..7395afe --- /dev/null +++ b/nginx.conf @@ -0,0 +1,40 @@ +server { + listen 80; + listen 443 ssl http2; + + server_name gps.example.com; + + ssl_certificate /etc/letsencrypt/live/gps.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/gps.example.com/privkey.pem; + include snippets/ssl.conf; + + if ($ssl_protocol = "") { + rewrite ^ https://$server_name$request_uri? permanent; + } + + location /endpoint.php { + proxy_pass http://127.0.0.1:6957/endpoint; + } + location /endpoint { + proxy_pass http://127.0.0.1:6957/endpoint; + } + + location /lib/ { + root /opt/pygps/; + } + + location / { + auth_basic "GPS Tracker"; + auth_basic_user_file "/etc/nginx/auth/gps"; + proxy_pass http://127.0.0.1:6957/; + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + send_timeout 600; + } + + location /.well-known/ { + root /opt/pygps/; + } + +}