Last active
March 14, 2024 17:45
-
-
Save amitkhare/a7867b9a3e25338803549901ea4bf3d8 to your computer and use it in GitHub Desktop.
Code-Server behind Apache2 Proxy with Letsencrypt SSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Located in :::: /lib/systemd/system/code-server.service | |
[Unit] | |
Description=code-server | |
After=network.target | |
[Service] | |
Type=simple | |
ExecStartPre=/bin/sleep 2 | |
User=1000 | |
Group=1000 | |
#start | |
ExecStart=/vsc-data/binary/bin/code-server --config /vsc-data/config.yaml | |
#stop | |
#ExecStop= | |
Restart=always | |
[Install] | |
WantedBy=default.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:443> | |
ServerName code.example.com | |
RewriteEngine On | |
RewriteCond %{HTTP:Upgrade} =websocket [NC] | |
RewriteRule /(.*) wss://127.0.0.1:8443/$1 [P,L] | |
SSLProxyEngine on | |
ProxyPreserveHost on | |
SSLProxyCheckPeerCN off | |
SSLProxyCheckPeerName off | |
ProxyPass / https://127.0.0.1:8443/ | |
ProxyPassReverse / https://127.0.0.1:8443/ | |
SSLCertificateFile /etc/letsencrypt/live/code.example.com/fullchain.pem | |
SSLCertificateKeyFile /etc/letsencrypt/live/code.example.com/privkey.pem | |
Include /etc/letsencrypt/options-ssl-apache.conf | |
</VirtualHost> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Located in :::: nano ~/.config/code-server/config.yaml | |
bind-addr: 0.0.0.0:8443 | |
auth: password | |
password: YOURPASSWORD | |
user-data-dir: /vsc-data/user-data | |
extensions-dir: /vsc-data/extensions-dir | |
app-name: "Khare's Code" | |
cert: true | |
Author
amitkhare
commented
Mar 4, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment