Skip to content

NginxProxy

Akkariin Meiko edited this page Nov 7, 2019 · 1 revision

通过 Nginx 反向代理服务端,为服务端增加 SSL 支持。

以下是 Nginx 的配置文件:

server {
  # 监听端口,设置为 index.html 里面 ws_hostname 的端口
  listen 810 ssl;
  # 你的 SSL 证书位置
  ssl_certificate /usr/local/nginx/conf/ssl/your-cert.crt;
  ssl_certificate_key /usr/local/nginx/conf/ssl/you-key.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  ssl_prefer_server_ciphers on;
  ssl_session_timeout 10m;
  ssl_session_cache builtin:1000 shared:SSL:10m;
  ssl_buffer_size 1400;
  ssl_stapling on;
  ssl_stapling_verify on;
  # 绑定的域名
  server_name your-domain.com;
  location / {
        # 反向代理后端的地址,端口号要设置为 server.php 里面的监听端口
        proxy_pass                  http://127.0.0.1:811;
        proxy_redirect              off;
        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_http_version          1.1;
        proxy_set_header Upgrade    $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
Clone this wiki locally