已解决
nginx 代理域名到另外一个域名
来自网友在路上 11058105提问 提问时间:2023-09-21 20:19:54阅读次数: 105
最佳答案 问答题库1058位专家为你答疑解惑
nginx 代理域名到另外一个域名
server {listen 80;server_name 原域名;location / { #return 301 http://新域名$request_uri; # 重定向到新域名 proxy_pass http://新域名/;proxy_redirect http://原域名/ http://新域名/;} }
server {listen 80;server_name 新域名;# websocket代理#location /webSocket/chat {# proxy_pass http://xxx.xxx.com/webSocket/chat;# proxy_set_header Host $host;# proxy_set_header Upgrade 'websocket';# proxy_set_header Connection 'Upgrade';# proxy_connect_timeout 4s;# proxy_read_timeout 7200s; #两个小时# proxy_send_timeout 12s;#}location / { proxy_pass http://localhost:8080;root html;index index.html index.htm;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}}
注意:用return
,可以重定向到新域名的页面,但是请求方法是有问题的
查看全文
99%的人还看了
相似问题
- Ubuntu中apt-get update显示域名解析失败
- 轻松搭建短域名短链接服务系统,可选权限认证,并自动生成证书认证把nginx的http访问转换为https加密访问,完整步骤和代码
- 域名的理解
- Nginx快速入门教程,域名转发、负载均衡
- Nginx:不同域名访问同一台机器的不同项目
- Ubuntu下启动Apache对.htaccess 的支持步骤, 利用.htaccess绑定域名到子目录
- 快速实现一个企业级域名 SSL 证书有效期监控巡检系统
- 企业泛域名SSL证书续费
- python脚本监听域名证书过期时间,并将通知消息到钉钉
- golang 发起 http 请求,获取访问域名的 ip 地址(net, httptrace)
猜你感兴趣
版权申明
本文"nginx 代理域名到另外一个域名":http://eshow365.cn/6-10937-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!
- 上一篇: 无涯教程-JavaScript - SUM函数
- 下一篇: zookeeper未授权漏洞复现及处理