Ask a question about how to configure a reverse proxy for nginx

Local cross-domain configuration is practical: proxy, local test cross-domain has no problem, the data can be accepted normally, and the background can console

  "/api": {
    "target": "http://132.232.22.140:8889/api",
    "changeOrigin": true,
    "pathRewrite": { "^/api" : "" }
  }

after deployment to the server, nginx configuration

server {
        listen 8000;
        -sharp server_name www.alatu..xyz;

        root /home/myftp/dist;
        index index.html index.htm;

        location / {
                try_files $uri $uri/ /index.html;
        }
        location ^~ /assets/ {
                gzip_static on;
                expires max;
                add_header Cache-Control public;
        }
location /api {
    rewrite  ^.+api/?(.*)$ /$1 break;
    include  uwsgi_params;
       proxy_pass   http://localhost:8889;
       }
        error_page 500 502 503 504 /500.html;
        client_max_body_size 20M;
        keepalive_timeout 10;
}

online tests do not receive data, and there is no console in the background. I am not very grateful for the help of my predecessors.

Apr.05,2021

see nginx logs, including access_log and error_log


the case is closed. It turns out that the biggest problem is that my backstage didn't write it right, and url wrote it wrong

.
    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  132.232.22.140:8000;
        root         /usr/share/nginx/html;
-sharp       root          /home/myftp/dist

        -sharp Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location ^~ /api/ {
            proxy_pass http://127.0.0.1:8889;
        }
        location /{
                proxy_pass   http://127.0.0.1:8000;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
    

8000 front-end port, 8889 background port, so the cross-domain is successful

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b348e2-2b69e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b348e2-2b69e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?