比较来自世界各地的卖家的域名和 IT 服务价格

代理服务器。 Nginx: 除了继承之外禁止所有内容

我正在尝试配置代理 Nginx 对于当前正在开发的节点应用程序。

我正在尝试从白色列表中访问主站点的IP地址,但我有办法 / api, 必须从任何IP地址提供。

我试图在不同的订单中确定地点块等,但没有立方体,现在它似乎没有传输任何请求 / api 代理

upstream node_upstream {
server 127.0.0.1:3000 fail_timeout=0;
}

server {
listen 80;
listen [::]:80;
server_name example.com;

location /api {
allow all;
}

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_buffering off;
proxy_pass [url=http://node_upstream;]http://node_upstream;[/url]
allow 1.2.3.4;
deny all;
}

location /public {
root /path/to/static/files;
}

listen 443 ssl;
... SSL Config here...

if ($scheme != "https") {
return 301 https://$host$request_uri;
}
}
已邀请:

莫问

赞同来自:

修复了理查德评论的建议。

Nginx 对应于一个位置块,因此我移动了在服务器上定义的头条新闻并安装 proxy_pass 适当的 allow, deny 在代理的路径上。

server {
listen 80;
listen [::]:80;

server_name example.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_buffering off;

location /api {
proxy_pass [url=http://node_upstream;]http://node_upstream;[/url]
allow all;
}

location / {
proxy_pass [url=http://node_upstream;]http://node_upstream;[/url]
allow 1.2.3.4;
deny all;
}
...
}

要回复问题请先登录注册