Nginx external network access intranet site configuration operation

Nginx external network access intranet site configuration operation

background:

The site is separated from the front and back ends: vue+springboot

Front-end intranet address: 192.168.1.10:81

API intranet address: 192.168.1.12:8080

External domain name: abc.ab.com External IP: 10.114.XX

need:

The site and static resources can be accessed through the domain name, and the API request data can be accessed

Solution 1: (Prerequisite: external domain name mapping server external IP)

1. nginx configures domain name monitoring and accesses static resources

2.Here comes the point! ! ! The address of the static resource request API is changed from 192.168.1.12:8080 to domain name access method (abc.ab.com:8080)

Restart nginx

Other solutions will be posted after the blogger has verified them! !

Supplementary knowledge: Use nginx to implement reverse proxy and realize external network access to internal network services

Environmental background, the server is Ubuntu:

A server A that can connect to the public network and the intranet, with a public IP address of 61.174.×.×. Another intranet server B has the Jenkins service installed, with an intranet IP address of 192.168.3.12

Steps:

Install nginx on A

sudo apt-get install nginx

After installation, go to the /etc/nginx/sites-enabled directory, open the files in the directory, and change the default port number to 8085.

Then go to the /etc/nginx/conf.d directory and create a new file jenkins.conf. The content of the file is as follows:

server{
listen 8085;
server_name 61.174.171.61;
 
location /{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Nginx-Proxy true;
proxy_pass http://192.168.3.12:8080;
proxy_redirect off;
}

Then execute

sudo nginx -t

sudo nginx -s reload

If an error occurs:

nginx: [error] invalid PID number "" in "/run/nginx.pid"

Then execute

sudo nginx -c /etc/nginx/nginx.conf

Then visit 61.174.171.61:8085 on the public Internet to access the Jenkins service on the intranet.

The above nginx external network access intranet site configuration operation is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Nginx port mapping configuration method
  • A universal nginx interface to implement reverse proxy configuration
  • Implementation of multi-port mapping of nginx reverse proxy

<<:  Detailed analysis of mysql MDL metadata lock

>>:  Elementui exports data to xlsx and excel tables

Blog    

Recommend

Realize three-level linkage of year, month and day based on JavaScript

This article shares the specific code for JavaScr...

Analysis of the difference between emits and attrs in Vue3

Table of contents in conclusion Practice Analysis...

Hyperlink icon specifications: improve article readability

1. What is the hyperlink icon specification ?<...

Detailed explanation of group by and having in MySQL

The GROUP BY syntax can group and count the query...

Essential skills for designing web front-end interfaces

[Required] UserInterface PhotoShop/Fireworks Desi...

Vue local component data sharing Vue.observable() usage

As components become more detailed, you will enco...

Causes and solutions for slow MySQL query speed and poor performance

1. What affects database query speed? 1.1 Four fa...

JavaScript Advanced Custom Exception

Table of contents 1. Concept 1.1 What are errors ...

How to use CSS attribute value regular matching selector (tips)

There are three types of attribute value regular ...

Introduction to MySQL method of deleting table data with foreign key constraints

When deleting a table or a piece of data in MySQL...