Advertisement
Guest User

Untitled

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