forked from jackyzha0/quartz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v4' of https://github.com/ArenaDruid/quartz into dev/ch…
…inese-italic
- Loading branch information
Showing
9 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: 利用Nginx反代实现软件对IPv6网络访问的支持 | ||
publish: true | ||
date: 2023-01-26 | ||
comments: true | ||
tags: | ||
- 运维 | ||
- Nginx | ||
description: | ||
--- | ||
# 前言 | ||
## 事情的起因 | ||
今天在为自己家里的NAS的Serviio家庭影音系统做调试的时候发现一个问题:Serviio的端口只能通过IPv4地址访问,而IPv6访问同样的端口却无法访问。如下图所示。 | ||
|
||
![[Pasted image 20250205162251.png]] | ||
*IPv4可以访问,IPv6无法访问* | ||
## 环境 | ||
- NAS:一台老台式机(i3-4150, 16G RAM, 500G HDD, Windows 8.1) | ||
- 客户机:戴尔G15 5511 | ||
- 网络: 光猫拨号, 两台红米AX6S做AP Mesh组网,NAS与其中一台红米做有线连接,客户机无线接入网络 | ||
|
||
--- | ||
|
||
# 问题及其原因 | ||
## 问题 | ||
一些软件在IPv4环境下可以正常访问,但是在IPv6环境上无法访问。 | ||
## 原因猜测 | ||
一些软件没有监听来自IPv6的相同端口,导致IPv6环境无法访问IPv4环境下可以访问的端口。 | ||
|
||
--- | ||
# 处理方案 | ||
1. 下载并且安装好Nginx(本文不提供教程[^1]) | ||
2. **修改conf文件**:在 `%nginx目录%\conf\nginx.conf` 文件中的 `http{}` 内输入以下代码 | ||
```nginx | ||
server{ | ||
listen [::]:<目标软件占用的端口>; | ||
server_name localhost; | ||
location /{ | ||
proxy_pass http://localhost:<目标软件占用的端口>/; | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
# 成果 | ||
![[Pasted image 20250205162912.png]]*IPv6和IPv4都能够正常访问* | ||
|
||
--- | ||
# 问题与展望 | ||
## 关于代码的进一步改进 | ||
文中使用的反代代码只用了一个proxy_pass,这导致在日志中会出现无法追溯到原始ip的问题,这个在家庭个人使用作者觉得可以接受,如果觉得有需要的读者,可以自行研究 proxy_set_header的内容。 | ||
## 公网下家用宽带通过IPv6访问NAS或者家用服务器 | ||
如今IPv4资源已经枯竭,而国家正在大力推动IPv6发展,并最后实现[IPv6单栈网络](http://www.cac.gov.cn/2021-07/23/c_1628629122784001.htm)的愿景。 | ||
|
||
目前,家用宽带获取IPv4公网IP的难度越来越高;而家庭通过互联网来实现对家用设备的远程操控的需求也越来越高,因而,从长期来看,IPv6是大势所趋。 但是目前有许多软件对IPv6的兼容性并不好,出现了一些类似于本文所提到的问题。 | ||
|
||
本文提供了一种通过反向代理的方法来兼容IPv6网络的访问,方便有需要的家庭通过IPv6来远程操控,当然作者也更加希望在软件开发者们能够针对IPv6开发出更好的软件。 | ||
|
||
--- | ||
# 版权声明 | ||
Copyright © 2025 arenadruid.top | [](https://creativecommons.org/licenses/by/4.0/) | ||
|
||
[^1]: 如今从官网下载的最新windows版nginx和Ubuntu通过apt安装的最新nginx都是支持ipv6功能的 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters