[Nginx] HTTP to HTTPS – 80 to 443 – 自動轉導

設定檔 這裡拿一個非Default的Site Host作範例。 添加80port的設定檔範例: server { listen 80; listen [::]:80; server_name code.yidas.com; return 301 https://$server_name$request_uri; } 至於原來的設定檔則由80改至443: #listen 80; #listen [::]:80; # SSL configuration # listen 443 ssl; listen [::]:443 ssl;

[Nginx] 使用Proxy實作Load Balancer

Nginx設定: 直接給範例: # nginx conf http { upstream myapp1 { server srv1.example.com; server srv2.example.com; server srv3.example.com; } server { listen 80; location / { proxy_pass http://myapp1; } } } 簡而言之,在Http設定內註冊Upstream,在Server內使用Proxy Pass調用該Upstream Server Group。 分派演算法: round-robin — requests to the application […]