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
What is a stored procedure Simply put, it is a se...
mysql-5.7.17.msi installation, follow the screens...
Preface CSS grids are usually bundled in various ...
introduction If you are familiar with using JDBC ...
01. Overview Absolute paths and relative paths ar...
Dark background style page design is very popular...
This article describes the MySQL integrity constr...
This article shares the installation steps of MyS...
Yes, CSS has regular expressions too (Amen) Two p...
Table of contents Easy to use Create a project vu...
1. Design source code Copy code The code is as fol...
HTML tags explained 1. HTML tags Tag: !DOCTYPE De...
The progress bar is not smooth I believe that mos...
MySQL's index types include normal index, uni...
How long has it been since I updated my column? H...