Update README.md

This commit is contained in:
skeletor 2022-05-24 02:21:15 +00:00
parent dcc10ca63f
commit c2709dad0f

View File

@ -33,6 +33,41 @@ After your port is set to one that is compatible, create a new A record for a su
Finally, create a new page rule under the Page Rules tab in Cloudflare and disable SSL for the subdomain you created above. You will now be able to connect using secure websockets using the following example url, where I created an A record for the subdomain `ws` and I set my `ws.nitro.port` to 2096: `wss://ws.example.com:2096`
### Proxying WSS with Nginx
Alternatively, you can also proxy wss traffic with nginx. You will need a CA-signed certificate, since some browsers will block the connection on self-signed certificates. Below is an example nginx configuration file:
```
server {
listen 80;
listen 443 ssl http2;
server_name ws.example.com;
# Path for SSL config/key/certificate
ssl_certificate /etc/ssl/certs/nginx/cert.pem;
ssl_certificate_key /etc/ssl/certs/nginx/key.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
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_pass http://localhost:2096;
proxy_read_timeout 90;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
```
## FAQS ##
**I am getting the error `Unable to load ssl: File does not contain valid private key: ssl\privkey.pem`**