Finn

Finn

👨🏻‍💻工作:Web3 产品经理 🏙️城市:香港 🧩性格:INFP 最近在做 GameFi,能赚钱的游戏
jike
email

Install code-server on the server to enable programming from anywhere, on any device.

Environment: Centos
Configuration: 4h2g (tried 2h2g, no lag)

Installation#

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

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

External Access#

  1. Install Nginx
  2. Open the corresponding port
  3. Modify the Nginx configuration file:
server {
    listen 111;
    server_name 222.222.222.222;

    location / {
        proxy_pass http://127.0.0.1:222;
        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;
    }
}
  • Change 111 to the external access interface
  • Change 222.222.222.222 to the server IP
  • Change :222 to the code-server server internal interface

This way, you can code anywhere, on any device, without changing the environment and programming parameters due to device changes.

And all commands are executed on the server, so you don't have to worry about configuring the environment on multiple devices.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.