Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # 設置虛擬伺服器的配置
  2. server {
  3.     # 僅對 IPv4 啟用用於外部訪問的 80 端口號
  4.     listen *;
  5.     # 設置虛擬伺服器的名稱
  6.     server_name example.com;
  7. }
  8.  
  9. server {
  10.     # 僅對 IPv4 啟用用於外部訪問的 443 端口號,並啟用 HTTPS 和 HTTP/2 協議
  11.     listen 443 ssl http2;
  12.     # 設置虛擬伺服器的名稱
  13.     server_name example.com;
  14.  
  15.     # 為給定的虛擬伺服器指定一個具有 PEM 格式的密鑰文件
  16.     ssl_certificate_key /etc/ssl/private/example.com.key;
  17.     # 為給定的虛擬伺服器指定一個具有 PEM 格式的證書文件
  18.     ssl_certificate /etc/ssl/example.com.pem;
  19.  
  20.     # 主頁面
  21.     location ^~ / {
  22.         root /home/wwwroot/sCalc/;
  23.     }
  24.  
  25.     # 統一 404 頁面
  26.     proxy_intercept_errors on;
  27.     error_page 404 = /404.html;
  28.     location ^~ /404.html {
  29.         return 404;
  30.     }
  31.  
  32.     # 反代 V2Ray 的 WebSocket
  33.     location = /abcd321 {
  34.         if ($http_upgrade != "websocket") {
  35.             return 404;
  36.         }
  37.         proxy_redirect off;
  38.         proxy_pass http://127.0.0.1:23322;
  39.         proxy_http_version 1.1;
  40.         proxy_set_header Upgrade $http_upgrade;
  41.         proxy_set_header Connection "upgrade";
  42.         proxy_set_header Host $host;
  43.         proxy_set_header X-Real-IP $remote_addr;
  44.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement