Nginx Intranet Standalone Reverse Proxy Ubuntu18.04 virtual machine 1 IP: 192.168.10.10 Test purpose: Deploy Nginx server on virtual machine 1 (192.168.10.10:80), access the self-set domain name through the browser, and reverse proxy to the intranet virtual machine 2 (192.168.10.11:1234). It is best that virtual machine 2 can be accessed with a browser, and the display interface is different from Nginx, such as installing a tomcat. 1 Nginx InstallationVirtual machine 1 is used as the Nginx server and is installed as follows: sudo apt-get install build-essential sudo apt-get install libtool sudo apt-get update sudo apt-get install libpcre3 libpcre3-dev sudo apt-get install zlib1g-dev sudo apt-get install openssl sudo apt-get update sudo apt-get install nginx Run the systemctl status nginx command to verify whether the installation is successful. $ systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en Active: active (running) since Mon 2021-11-01 10:07:38 CST; 4h 19min ago Docs: man:nginx(8) Main PID: 8915 (nginx) Tasks: 3 (limit: 9461) CGroup: /system.slice/nginx.service ├─8915 nginx: master process /usr/sbin/nginx -g daemon on; master_pro ├─8916 nginx: worker process └─8917 nginx: worker process ... 2 Configure NginxVirtual Machine 1: /etc/nginx/nginx.conf is the main configuration file. I haven't studied it in detail, but be sure to uncomment the following content: include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; After modification, restart Nginx with service nginx restart. Create /etc/nginx/conf.d/test.conf as follows: server { listen 80; #Nginx server listening port charset utf-8; server_name test.com; #Domain name 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.10.11:1234/; #reverse proxy IP+port proxy_redirect off; } } In the proxy_pass http://192.168.10.10:1234/; line, don’t forget to add the final slash ‘/’. nginx -s reload updates the configuration The principle of reload: 3 Modify the hosts fileVirtual machine 1 adds the following to the /etc/hosts file: 4 TestingEnter 192.168.10.10 in the browser, and the text of Nginx is displayed. This is the Nginx effect of virtual machine 1 itself. When you enter test.com, the application content of virtual machine 2 appears, indicating that the reverse proxy is successful. This is the end of this article about the implementation of Nginx intranet stand-alone reverse proxy. For more relevant Nginx intranet reverse proxy content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: JavaScript BOM location object + navigator object + history object
>>: Solution to inserting a form with a blank line above and below
Preface The notification bar component is a relat...
Use the system crontab to execute backup files re...
Enter the /etc/yum.repos.d/ folder Create rabbitm...
Preface Recently, I encountered a requirement. Du...
It's easy to send messages to other users in ...
Startups often bring us surprises with their unco...
1. Download the tomcat image docker pull tomcat:8...
1. Problem The docker container logs caused the h...
Table of contents Basic HTML structure Generate s...
Preface JavaScript is one of the widely used lang...
Execute the command to install the plugin postcss...
Table of contents Overview Property settings Proc...
Table of contents Preface 1. Cause of the problem...
Error screenshot Can't find where the excepti...
Table of contents Preface 1. Download MySQL from ...