[Web Server] Nginx/Apache 環境變數設定 (Environment Variables)

Intro Nginx/Apache 環境變數設定速查 Nginx設定 fastcgi_param RUNTIME_ENVIROMENT ‘DEV’ For example: server { listen 80; root /var/www/html; index index.php; server_name localhost; location / { index index.php; } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param RUNTIME_ENVIROMENT ‘DEV’ } } Apache設定 Environment […]

[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 […]