Add nginx and systemd deploy examples
This commit is contained in:
parent
7f32ad46d9
commit
f500554281
2 changed files with 74 additions and 0 deletions
49
deploy/nginx.conf.example
Normal file
49
deploy/nginx.conf.example
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
# Example nginx config for oscar-web behind HTTPS.
|
||||||
|
# Adjust server_name, certificate paths, and upstream port.
|
||||||
|
|
||||||
|
upstream oscar_web {
|
||||||
|
server 127.0.0.1:3000;
|
||||||
|
keepalive 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name chat.example.com;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name chat.example.com;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/chat.example.com/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/chat.example.com/privkey.pem;
|
||||||
|
|
||||||
|
# Add your preferred TLS/HSTS settings.
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
|
||||||
|
# SSE endpoint: disable buffering and allow long-lived connection.
|
||||||
|
location /api/events {
|
||||||
|
proxy_pass http://oscar_web;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Connection '';
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_cache off;
|
||||||
|
proxy_read_timeout 1h;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://oscar_web;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
25
deploy/oscar-web.service.example
Normal file
25
deploy/oscar-web.service.example
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Example systemd unit for oscar-web.
|
||||||
|
# Copy to /etc/systemd/system/oscar-web.service and adjust paths/user.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Oscar Web chat client
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=oscar-web
|
||||||
|
Group=oscar-web
|
||||||
|
WorkingDirectory=/opt/oscar-web
|
||||||
|
EnvironmentFile=/opt/oscar-web/.env
|
||||||
|
ExecStart=/usr/bin/node --env-file=/opt/oscar-web/.env src/server.js
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
# Hardening (adjust as needed for your environment)
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateTmp=true
|
||||||
|
ProtectSystem=strict
|
||||||
|
ProtectHome=true
|
||||||
|
ReadWritePaths=/opt/oscar-web/data
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Loading…
Add table
Reference in a new issue