diff --git a/content/self-host/rustdesk-server-pro/faq/_index.en.md b/content/self-host/rustdesk-server-pro/faq/_index.en.md index 3f875f2..65606f4 100644 --- a/content/self-host/rustdesk-server-pro/faq/_index.en.md +++ b/content/self-host/rustdesk-server-pro/faq/_index.en.md @@ -263,7 +263,7 @@ There are two ways: ```sh cat > /etc/nginx/sites-available/rustdesk.conf << EOF server { -server_name ; + server_name ; location / { proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; @@ -280,7 +280,7 @@ Run `cat /etc/nginx/sites-available/rustdesk.conf` to make sure its content is c ```sh cat > /etc/nginx/conf.d/rustdesk.conf << EOF server { -server_name ; + server_name ; location / { proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; @@ -310,7 +310,7 @@ If it prompts `Enter email address (used for urgent renewal and security notices Finally, the content of `rustdesk.conf` should be like this: ``` server { -server_name ; + server_name ; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -322,17 +322,16 @@ server_name ; ssl_certificate_key /etc/letsencrypt/live//privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot - } + server { if ($host = ) { return 301 https://$host$request_uri; } # managed by Certbot -server_name ; + server_name ; listen 80; return 404; # managed by Certbot - } ``` @@ -363,7 +362,86 @@ Solution: it may be caused by firewall, please refer to https://rustdesk.com/doc Notice: Run `sudo service nginx restart` if you change the `rustdesk.conf` manually. #### 7. Login to the web page -* Open https:// in the browser, log in using the default user name "admin" and password "test1234", then change the password to your own. +* Open `https://` in the browser, log in using the default user name "admin" and password "test1234", then change the password to your own. + +### 8. Add WebSocket Secure (WSS) support for the id server and relay server to enable secure communication for the web client. + +Add the following configuration to the first server section of the `/etc/nginx/.../rustdesk.conf` file, then restart the Nginx service. + +``` + location /ws/id { + proxy_pass http://localhost:21118; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + 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; + } + + location /ws/relay { + proxy_pass http://localhost:21119; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + 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; + } +``` + +The full configuration is + +``` +server { + server_name ; + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://127.0.0.1:21114/; + } + + location /ws/id { + proxy_pass http://localhost:21118; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + 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; + } + + location /ws/relay { + proxy_pass http://localhost:21119; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + 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; + } + + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live//fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live//privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot +} + +server { + if ($host = ) { + return 301 https://$host$request_uri; + } # managed by Certbot + + server_name ; + listen 80; + return 404; # managed by Certbot +} +``` ### SELinux