nginx - 如何设置 nginx 将请求代理到我的 Web 应用程序?
问题描述
我需要如何配置我的 nginx 以代理对我的应用程序的请求?如果我的(前端)应用程序在 10.10.10.10:9999 地址上运行,并且我想在浏览器中使用 访问它myapplication.com
,那么正确的配置是什么?
我现在有这些,但似乎不起作用:
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name myapplication.com;
location / {
proxy_set_header x-real-IP $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header host $host;
proxy_pass http://10.10.10.10:9999;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
解决方案
推荐阅读
- php - 将整数转换为数组内的字符串
- r - 在一张图表上,我想按年份列出 44 个城市的人口。但是第一个城市的“情节”陈述不是由其他城市的“线”完成的
- lua - 我如何让一个角色用键盘向上/向下移动?[罗布洛克斯/Lua]
- wpf - Xamarin 窗体 ToolbarItems WPF 辅助
- linux - 组装排序输出的升序
- java - 在重复的字符串中查找任何字符出现的总次数
- sql - 如何使用 while 循环增加自定义 ID 字段?
- spring - Hibernate Validation 不在 Spring Boot 应用程序中查找错误消息
- latex - 如何在 LaTex 中定义图片的指定页面?
- php - PHP仅循环表单文本字段