“This is the 26th day of my participation in the November Gwen Challenge. See details of the event: The Last Gwen Challenge 2021”.

background

Believe that many students will face such problems in daily work, the development of the virtual machine can only access the company network, and not be able to access the Internet, this will cause difficult in the development of a virtual machine to install software, rely on to solve the offline installation is a big problem, if you ever do this, you will find that rely on dependence and rely on, just like dolls.

How to solve it?

Private sources can be used to solve the problem, but it is not as convenient and direct as online installation.

You may also be wondering, my PC can access the Internet, and my PC can access the development virtual machine, so can my development virtual machine directly access the Internet through the office PC as a proxy? The answer is: yes!

How to do?

Avoid install Nginx

Download address: nginx.org/en/download.html

Download the green version download decompression.

Modify the nginx. Conf

worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; Server {resolver 114.114.114.114; Listen 880 default_server; location / { proxy_pass http://$host$request_uri; Proxy_set_header HOST $HOST; proxy_buffers 256 4k; proxy_max_temp_file_size 0k; proxy_connect_timeout 30; proxy_send_timeout 60; proxy_read_timeout 60; proxy_next_upstream error timeout invalid_header http_502; }} server {resolver 114.114.114.114; 443 default_server; location / { proxy_pass https://$host$request_uri; Proxy_set_header HOST $HOST; proxy_buffers 256 4k; proxy_max_temp_file_size 0k; proxy_connect_timeout 30; proxy_send_timeout 60; proxy_read_timeout 60; proxy_next_upstream error timeout invalid_header http_502; } } server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }}}Copy the code

Start the nginx

Go to the nginx directory and run the following command: start. \nginx.exe

To view nginx services:

Configure the agent on the development machine

Mosaic place isPCIP

At this point, our development machine can already access the Internet through a PC as a proxy.