How to configure Nginx to support ipv6 under Linux system

How to configure Nginx to support ipv6 under Linux system

1. Check whether the existing nginx supports ipv6

You need to execute the following command to check whether the existing nginx supports ipv6. If the parameter contains --with-ipv6, it supports it. If not, it does not support it and you need to recompile nginx.

# The nginx path here is based on your actual nginx startup file path /usr/local/nginx-1.14.0/sbin/nginx -V

2. Recompile nginx to support ipv6

1. Download the corresponding nginx installation package;

2. Unzip the nginx installation package;

3. Enter the installation file after decompressing nginx, execute the ./configure command first, then add the parameters obtained from /usr/local/nginx-1.14.0/sbin/nginx -V above, and then add the --with-ipv6 parameter and execute;

4. Execute the make command, and never execute the make install command, otherwise the original nginx will be overwritten;

5. Back up the nginx executable file in the original path:

sudo cp /usr/local/nginx-1.14.0/sbin/nginx /usr/local/nginx-1.14.0/sbin/nginx.old

6. After make, enter the objs folder under the installation folder;

cd objs

7. Stop the original nginx service, overwrite the original nginx execution file, and start the nginx service:

sudo /usr/local/nginx-1.14.0/sbin/nginx -s stop
sudo cp nginx /usr/local/nginx-1.14.0/sbin/nginx
sudo /usr/local/nginx-1.14.0/sbin/nginx

Replenish:

Monitor both IPV4 and IPV6

server {
....
listen [::]:80;
...
} 

Listen only to IPv6

server {
....
listen [::]:80 default ipv6only=on;
...
}

Listen to the specified IPV6 address

server {
....
listen [3608:f0f0:3002:31::1]:80;
...
}

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Summary of three methods for implementing grayscale release in Nginx
  • Detailed explanation of Asp.Net Core publishing and deployment (MacOS + Linux + Nginx)
  • A brief analysis of nginScript, the JavaScript capability just released by nginx
  • Detailed explanation of Nginx's control over access volume
  • Setting up a proxy server using nginx
  • Docker container deployment attempt - multi-container communication (node+mongoDB+nginx)
  • Detailed explanation of Nginx proxy_redirect usage
  • Example of how to install nginx to a specified directory
  • Detailed explanation of the front-end and back-end deployment tutorial based on Vue and Nginx
  • How to use nginx to simulate canary release

<<:  How to find slow SQL statements in MySQL

>>:  Implementation steps for building multi-page programs using Webpack

Recommend

Introduction and examples of hidden fields in HTML

Basic syntax: <input type="hidden" na...

MySQL 5.7 installation and configuration tutorial

This article shares the MySQL installation and co...

JavaScript implements double-ended queue

This article example shares the specific code of ...

CSS imitates Apple's smooth switch button effect

Table of contents 1. Code analysis 2. Source code...

How to extend Vue Router links in Vue 3

Preface The <router-link> tag is a great to...

SQL implementation LeetCode (185. Top three highest salaries in the department)

[LeetCode] 185. Department Top Three Salaries The...

How does Zabbix monitor and obtain network device data through ssh?

Scenario simulation: The operation and maintenanc...

Json string + Cookie + localstorage in JS

Table of contents 1.Json string 1.1Json Syntax 1....

Mysql cannot select non-aggregate columns

1. Introduction I recently upgraded my blog and a...

How to enable remote access permissions in MYSQL

1. Log in to MySQL database mysql -u root -p View...