nginx如何重写或跳转8000端口到443

例如把:

test.domain.com:8000/event/123

跳转到:

https://test.domain.com/event/123
阅读 6.8k
2 个回答

在你8000的server配置里加上下面代码就行

rewrite ^/event/123 https://test.domain.com/event/123 permanent;
server {
  listen    8000;
  server_name test.domain.com;
  return 301 $scheme://test.domain.com$request_uri;
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题