windows - 修改 nginx.conf 以侦听 UDP 端口并将收到的消息转发到另一个 IP 地址
问题描述
语境
我需要用可以托管静态 IPv4 地址并转发的 Azure 资源管理器 (ARM) 资源替换 Azure 经典云工作者角色(其工作是侦听专用固定 IP 地址,例如 99.99.99.99 udp 端口 10000) UDP 流量。
解决方案
作为垫脚石的一种正在测试的解决方案是在 Azure Windows Server VM 上使用 NGINX,并将数据转发到另一个托管容器服务的 ARM 资源。
问题
NGINX 对我来说是全新的,我正在努力将 nginx.conf 配置为
- 监听 IPv4 地址
- UDP 端口 10000
- 将收到的消息转发到另一个 IPv4 地址
我已经从另一篇堆栈文章中尝试过这个(下面是我的 nginx.conf 文件的副本,直到我实现了更改,即从“流”):
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
stream {
server {
listen 10100 udp;
proxy_pass juniper_close_stream_backend;
}
upstream juniper_close_stream_backend {
server 99.99.99.99:10000;
}
}
#error_page 404 /404.html;
修改此配置文件时,NGINX 服务将无法启动。搜索系统日志我找不到任何错误消息。显然配置更改的格式不正确。我可以恢复到默认文件并启动服务。
问题
如何将 nginx.config 修改为
- 监听 IPv4 地址
- 在 UDP 端口 10000
- 然后将收到的消息转发到另一个 IPv4 地址?
谢谢
解决方案
推荐阅读
- javascript - 如何将图表输出导出为 JPEG 或 png 格式?
- python - 更改 tkinter 消息框的大小
- emacs - 在 org-agenda 中看不到时间线视图
- amazon-web-services - 如何解决 AWS CloudFormation 不一致的属性属性定义?
- mysql - MySQL如何按升序选择行2重复的列值
- c++ - 传递给函数的二维数组的大小
- java - OneDrive 下载会话最长时间
- python - 使用 gridsampler 进行 PyTorch 图像转换,优化网格时的奇怪行为
- ruby-on-rails - 这个 ruby(rails) 代码是否易于阅读?
- javascript - 如何保持整个链接