1 Star 0 Fork 3

apollo_wuhan / code-server

forked from NCR / code-server 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
quickstart.md 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
Asher 提交于 2019-10-23 11:49 . Add security section to readme

Quickstart Guide

  1. Visit the releases page and download the latest binary for your operating system.
  2. Unpack the downloaded file then run the binary.
  3. In your browser navigate to localhost:8080.

Usage

Run code-server --help to view available options.

Nginx Reverse Proxy

The trailing slashes are important.

server {
  listen 80;
  listen [::]:80;
  server_name code.example.com code.example.org;
  location /some/path/ { # Or / if hosting at the root.
      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;
  }
}

Apache Reverse Proxy

<VirtualHost *:80>
  ServerName code.example.com

  RewriteEngine On
  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteRule /(.*)           ws://localhost:8080/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket [NC]
  RewriteRule /(.*)           http://localhost:8080/$1 [P,L]

  ProxyRequests off
  ProxyPass        / http://localhost:8080/ nocanon
  ProxyPassReverse / http://localhost:8080/
</VirtualHost>

Run automatically at startup

In some cases you might need to run code-server automatically once the host starts. You may use your local init service to do so.

Systemd

[Unit]
Description=Code Server IDE
After=network.target

[Service]
Type=simple
User=<USER>
EnvironmentFile=$HOME/.profile
WorkingDirectory=$HOME
Restart=on-failure
RestartSec=10

ExecStart=<PATH TO BINARY> $(pwd)

StandardOutput=file:/var/log/code-server-output.log
StandardError=file:/var/log/code-server-error.log

[Install]
WantedBy=multi-user.target

OpenRC

#!/sbin/openrc-run

depend() {
    after net-online
    need net
}

supervisor=supervise-daemon
name="code-server"
command="/opt/cdr/code-server"
command_args=""

pidfile="/var/run/cdr.pid"
respawn_delay=5

set -o allexport
if [ -f /etc/environment ]; then source /etc/environment; fi
set +o allexport

Kubernetes/Docker

Make sure you set your restart policy to always - this will ensure your container starts as the daemon starts.

1
https://gitee.com/apollo-from-wuhan_admin_admin/code-server.git
git@gitee.com:apollo-from-wuhan_admin_admin/code-server.git
apollo-from-wuhan_admin_admin
code-server
code-server
master

搜索帮助