Get the App
SLTechnology News&Howtos  ›  Development  › 

Solution with 502 error in Nginx

Shulou Source: shulou.com Published: 2022-06-03 12:38:32 11月15日 Update

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!

Tags: Errors files configurations solutions content methods more knowledge practicality learning and then code just need dilemma reality situation article time case Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MariaDB Shulou Tech Info OPPO Reno Microsoft