[英]Nginx - Load balancing returns 404 on Windows
我從這里安裝了Windows版Nginx(64位),因為官方二進制文件是32位。 目的是使用Nginx來平衡NodeJS應用程序的負載。 我從這里按照說明進行操作,其中還存在指向示例基本配置文件的鏈接 。
以下配置文件在通過Ubuntu PPA安裝了nginx
Linux上成功運行。 服務器本身通過pm2
啟動。
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream top_servers {
# Use IP Hash for session persistence
ip_hash;
# Least connected algorithm
least_conn;
# List of Node.JS Application Servers
server 127.0.0.1:3001;
server 127.0.0.1:3002;
server 127.0.0.1:3003;
server 127.0.0.1:3004;
}
server {
listen 80;
server_name ip.address;
location /topserver/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://top_servers;
proxy_set_header X-Request-Id $request_id;
}
}
但是,此文件不適用於Windows。 我在Windows上Nginx安裝的html
文件夾下收到“沒有這樣的文件或目錄”錯誤。 對於Linux,我尚未進行任何此類設置。
您能幫我將上述配置文件轉換為Windows嗎?
注意:我別無選擇-Windows是該項目的必備條件。
因此,我用上面顯示的內容conf/nginx.conf
了conf/nginx.conf
的內容。 首先,出現錯誤,因為"map" directive is not allowed here
。 然后,刪除此指令后,出現另一個錯誤,因為"upstream" directive is not allowed here"
。”我認為,我使用的二進制文件不支持負載平衡。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.