Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up a proxy server in nginx

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to set up a proxy server in nginx? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

Step 1: start nginx

[root@devops] # docker run-p 8888 nginxc7baab8ea9da0a148aa9bcc1295a54391906f6be94efca7189df23ceecdbf714 8888-- name proxy-nginx-d nginxc7baab8ea9da0a148aa9bcc1295a54391906f6be94efca7189df23ceecdbf714 [root@devops] #

Step 2: setting nginx

Enter the container

[root@devops ~] # docker exec-it proxy-nginx sh

Update apt-get

Install ping/vi/ps:apt-get update; apt-get install procps vim inetutils-ping

Set nginx.conf

Add the following to achieve the simplest proxy function

Resolver 8.8.8.8; server {listen 8888; location / {proxy_pass http://$http_host$request_uri;}}

The rest of the information is confirmed by nginx.conf and has not been modified

# cat nginx.confuser nginx;worker_processes 1 error error log / var/log/nginx/error.log warn;pid / var/run/nginx.pid;events {worker_connections 1024;} http {include / etc/nginx/mime.types; default_type application/octet-stream Log_format main'$remote_addr-$remote_user [$time_local] "$request"'$status $body_bytes_sent "$http_referer"'"$http_user_agent"$http_x_forwarded_for"; access_log / var/log/nginx/access.log main; sendfile on; # tcp_nopush on; keepalive_timeout 65; # gzip on; resolver 8.8.8.8; server {listen 8888 Location / {proxy_pass http://$http_host$request_uri;}} include / etc/nginx/conf.d/*.conf;} #

Step 4: setting the client

Set the server IP and port 8888 above on the client side to connect to the network by changing the proxy server.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report