TutorialsAugust 4, 20264 min read

How to Install code-server (VS Code in the Browser)

Run VS Code in your browser from your VPS: install code-server on Ubuntu 24.04, secure it behind Nginx with HTTPS, and code from anywhere.

NBy Nxeon

code-server runs a full VS Code environment on your VPS and serves it in the browser, so you can edit and run code from any device — a laptop, a tablet, a borrowed machine — with your project, terminal, and extensions living on the server. This guide installs code-server on Ubuntu 24.04 and secures it behind Nginx with HTTPS.

Why run VS Code on a server?

Your development environment lives where your code runs. That means no "works on my machine" gaps, access from anywhere, and the server's CPU and RAM doing the heavy lifting instead of a thin client. It pairs naturally with the other developer tooling on your box — databases, Docker, and your app all a terminal away.

Install code-server

The maintainers provide an install script that sets up the apt repository and a systemd service:

curl -fsSL https://code-server.dev/install.sh | sh

This installs code-server and registers a per-user systemd service. Start it for your user:

sudo systemctl enable --now code-server@$USER
sudo systemctl status code-server@$USER

By default it listens on 127.0.0.1:8080 — local only, which is exactly what we want before adding a secure proxy.

Find your password

The installer generates a random password in a config file:

cat ~/.config/code-server/config.yaml

You will see bind-addr, auth: password, and a password: line. Note that password — you will need it to log in. You can change it here and restart the service.

The Nxeon game-server control panel — live console, player slots, and TPS
The Nxeon game-server control panel — live console, player slots, and TPS

Expose it securely with Nginx

Never expose code-server directly — it is effectively a remote shell into your server. Put it behind Nginx with HTTPS on a subdomain. Create /etc/nginx/sites-available/code.example.com:

server {
    listen 80;
    server_name code.example.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
}

The Upgrade/Connection headers are essential — the editor relies on WebSockets and will not load without them. Enable the site and add TLS:

sudo ln -s /etc/nginx/sites-available/code.example.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d code.example.com

The general approach is our Nginx reverse proxy guide, and TLS detail is in the Certbot guide. Now visit https://code.example.com, enter the password, and you have VS Code in your browser.

Lock it down further

Because code-server gives full access to your server, harden it:

  • Keep the strong generated password (or set your own long one).
  • Restrict the subdomain to your IP in UFW or Nginx if it is single-user.
  • Apply the broader Linux VPS hardening checklist.

Install extensions and use the terminal

code-server uses the Open VSX registry for extensions — install them from the usual Extensions panel. The integrated terminal is a real shell on your VPS, so you can run git, npm, docker, and manage your systemd services right there. Combined with git-based deploys, you can edit, commit, and ship without ever leaving the browser.

Keep it running and updated

Because the installer registered a systemd service, code-server starts on boot and restarts if it crashes — check it with sudo systemctl status code-server@$USER. Updating is a one-liner that re-runs the installer:

curl -fsSL https://code-server.dev/install.sh | sh
sudo systemctl restart code-server@$USER

Your settings, extensions, and open workspace persist across updates because they live in your home directory.

Make it feel like local VS Code

A few touches close the gap with a desktop editor. Increase the terminal scrollback and turn on settings sync from within the editor's settings. Because the whole environment lives on the server, you can keep your dotfiles, shell config, and project-specific .vscode settings right there and they follow you to any browser. Pair code-server with the developer tools already on your box — run Docker builds, query PostgreSQL, and manage services from the integrated terminal — and the browser becomes a genuinely complete workspace.

FAQ

Is code-server the same as GitHub Codespaces?

It is the same idea — VS Code in the browser — but self-hosted on your own VPS, so you control the environment, cost, and data. There is no per-hour billing; the server is always yours.

Is it safe to run code-server on a public VPS?

Only behind HTTPS with authentication, as above. It grants full shell access, so treat it like SSH: strong password, TLS, and ideally IP restrictions. Never expose the raw :8080 port to the internet.

Can multiple people use one code-server?

code-server is designed for single-user use per instance. For a team, run a separate instance per user on different ports and subdomains, each as its own code-server@user service.

Which extensions work?

Most do, installed from the Open VSX registry that code-server uses by default. A few Microsoft-proprietary extensions are unavailable, but the vast majority of language and tooling extensions work fine.

Nxeon VPS hosting for developers gives you the root access and NVMe speed to run code-server as your always-on cloud IDE — with free migration help to bring your projects across.

#code-server#vscode#self-hosted#vps#ubuntu#seobatch

Deploy your first server in under a minute

Creating an account is free and takes no card details. You pay when you deploy — choose a billing term and pay from your wallet or by card at checkout.