gpt4 book ai didi

node.js - Nginx 和 node.js 未知指令

转载 作者:搜寻专家 更新时间:2023-11-01 00:10:14 24 4
gpt4 key购买 nike

我正在尝试为 nginx 编写配置文件,但出现此错误:

unknown directive "proxy_http_version" in /etc/nginx/conf.d/mydomain.conf:24

配置文件位置:/etc/nginx/conf.d/mydomain.conf

Nginx 版本: 我安装了 nginx/1.0.15。

这是我的配置文件。请帮我解决这个问题。

upstream node_app {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
}

server {
listen 80;
server_name mydomain.com;

# !!! handle static content requests and serve with nginx !!! #
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
root /var/www/html/mydomain.com/public/;
}

# !!! handle dynamic content requests and serve with node defined in upstream node_app object. !!! #
location ~* ^[^\.]+$ {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://node_app;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

最佳答案

更新 nginx!在 NGINX 1.1.4 版本中添加了 proxy_http_version 特性

关于node.js - Nginx 和 node.js 未知指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24499135/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com