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

Solution with 502 error in Nginx

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "the solution to the 502 error in Nginx". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Method 1: add the following red code to the Nginx.conf configuration file

Erver {listen 80; server_name www.tt.com; location / {proxy_pass http://week; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if (!-f $request_filename) {proxy_pass http://127.0.0.1:8888;}}

17.0.0.1Disp 8888 is configured as follows

Erver {listen 8888; server_name www.tt.com; location / {root / root; index index.html; error_page 500502404 / 404.html;}}

When maintenance is needed, you only need to restart the Nginx service.

Kill-HUP 'cat logs/ nginx. Pid'

Method 2: create a testnginx.conf file simply *

# user nobody; worker_processes 1; pid logs/nginx.pid; events {use epoll; worker_connections 50000;} http {include mime.types; default_type application/octet-stream; sendfile on; server {listen 80; server_name www.tt.com; location / {root / root; index index.html; error_page 500 502 404 / 404.html;}

During maintenance, you only need to stop the Nginx 502 error and re-enable the new profile.

This is the end of killall-9 nginx nginx-c. / conf/testnginx.conf "solution to Nginx error 502". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report