-
Notifications
You must be signed in to change notification settings - Fork 5.9k
doc/guide: Improve nginx docs #1902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
- [SSH forwarding](#ssh-forwarding) | ||
- [Let's Encrypt](#lets-encrypt) | ||
- [Self Signed Certificate](#self-signed-certificate) | ||
- [NGINX](#nginx) | ||
- [Change the password?](#change-the-password) | ||
- [How do I securely access development web services?](#how-do-i-securely-access-development-web-services) | ||
|
||
|
@@ -193,6 +194,8 @@ mydomain.com | |
reverse_proxy 127.0.0.1:8080 | ||
``` | ||
|
||
Remember to replace `mydomain.com` with your domain name! | ||
|
||
5. Reload caddy with: | ||
|
||
```bash | ||
|
@@ -204,6 +207,48 @@ Visit `https://<your-domain-name>` to access `code-server`. Congratulations! | |
In a future release we plan to integrate Let's Encrypt directly with `code-server` to avoid | ||
the dependency on caddy. | ||
|
||
#### NGINX | ||
|
||
If you prefer to use NGINX instead of Caddy then please follow steps 1-2 above and then: | ||
|
||
3. Install `nginx`: | ||
|
||
```bash | ||
sudo apt update | ||
sudo apt install -y nginx certbot python-certbot-nginx | ||
``` | ||
|
||
4. Put the following config into `/etc/nginx/sites-available/code-server` with sudo: | ||
|
||
```nginx | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name mydomain.com; | ||
|
||
location / { | ||
proxy_pass http://localhost:8080/; | ||
proxy_set_header Host $host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection upgrade; | ||
proxy_set_header Accept-Encoding gzip; | ||
} | ||
} | ||
``` | ||
|
||
Remember to replace `mydomain.com` with your domain name! | ||
|
||
5. Enable the config: | ||
|
||
```bash | ||
sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server | ||
sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m [email protected] | ||
``` | ||
|
||
Make sure to substiute `[email protected]` with your actual email. | ||
|
||
Visit `https://<your-domain-name>` to access `code-server`. Congratulations! | ||
|
||
### Self Signed Certificate | ||
|
||
**note:** Self signed certificates do not work with iPad and will cause a blank page. You'll | ||
|
@@ -244,29 +289,6 @@ To avoid the warnings, you can use [mkcert](https://mkcert.dev) to create a self | |
trusted by your OS and then pass it into `code-server` via the `cert` and `cert-key` config | ||
fields. | ||
|
||
### Nginx reverse proxy | ||
|
||
If you prefer to use Nginx instead of Caddy here is a sample config (put e.g. in | ||
`/etc/nginx/sites-enabled/code-server`): | ||
|
||
```nginx | ||
server { | ||
listen 80 [::]:80; | ||
server_name your-domain-name-here.com; | ||
|
||
location / { | ||
proxy_pass http://127.0.0.1:8080/; | ||
proxy_set_header Host $host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection upgrade; | ||
proxy_set_header Accept-Encoding gzip; | ||
} | ||
} | ||
``` | ||
|
||
It's highly recommended to set up a LetsEncrypt certificate and HTTP->HTTPS redirect as well. | ||
In order to do this run `certbot --nginx -d your-domain-name-here.com`. | ||
|
||
### Change the password? | ||
|
||
Edit the `password` field in the `code-server` config file at `~/.config/code-server/config.yaml` | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo on
substitute
.