我下面这个教程https://medium.com/startup-founder-panel/deploying-a-meteor-app-with-nginx-from-scratch-1332b32e99a5
当我这样做sudo nginx -t
,我得到
nginx: [emerg] "map" directive is not allowed here in /etc/nginx/sites-enabled/app:2
nginx: configuration file /etc/nginx/nginx.conf test failed
Run Code Online (Sandbox Code Playgroud)
这是应用程序文件
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
location = /favicon.ico {
root /home/USERNAME/portal/programs/web.browser/app;
access_log off;
}
location ~* "^/[a-z0-9]{40}\.(css|js)$" {
gzip_static on;
root /home/USERNAME/portal/programs/web.browser;
access_log off;
}
location ~ "^/packages" {
root /home/USERNAME/portal/programs/web.browser;
access_log …
Run Code Online (Sandbox Code Playgroud) 我无法让 nginx 在启用 ip_hash 的情况下对内部连接进行负载平衡。我需要粘性会话,因为我在后端使用流星与套接字,但所有请求总是到达同一个后端。
nginx 访问日志文件显示以下 IP 地址:
192.168.0.20 - - [xx/xxx/2017:xx:xx:xx +xxxx] "GET /favicon.ico HTTP/1.1" 404 5 "http://xxxx.lokal/" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
192.168.0.11 - - [xx/xxx/2017:xx:xx:xx +xxxx] "GET /sockjs/602/dpkl6lfe/websocket HTTP/1.1" 101 55045 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
192.168.0.208 - - [xx/xxx/2017:xx:xx:xx +xxxx] "GET /sockjs/031/cx1kml79/websocket HTTP/1.1" 101 1146677 "-" "Mozilla/5.0 (iPad; CPU OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 …
Run Code Online (Sandbox Code Playgroud)