Home > Back-end >  Front-end vue published to Nginx1.18 unable to call on the back-end service
Front-end vue published to Nginx1.18 unable to call on the back-end service

Time:04-22

My nginx configuration file below
 
HTTP {
Include/etc/nginx/mime types;
Default_type application/octet - stream;

Log_format main '$remote_addr - $remote_user [$time_local] "$request"'
'$$body_bytes_sent status "$http_referer"'
'" $http_user_agent "" $http_x_forwarded_for";

Access_log/var/log/nginx/access. Log the main;

Sendfile on;
# tcp_nopush on;

Keepalive_timeout 65;

# gzip on;


Server {
Listen, 8081;
Server_name localhost.
Root/var/local/central/central_web/;
The index index. HTML;


The location/API {
Proxy_pass http://localhost:8760;
Add_header 'Access - Control - Allow - Origin' '*';
Add_header 'Access - Control - Allow - Credentials'' true '.
}
}
}



The error information is as follows: I use the same configuration, in the Docker container correctly, access to the background on independent centos 7 machines to visit an error, using the vue development code,
NPM run dev launched front-end system access back-end services also have no problem, should eliminate the problem of background services to nginx configuration are not ripe, but there are still other configuration reverse proxy configuration method
, please advise me. Thank you very much

Failed to load the resource: the server responded with a status of 502 (Bad Gateway)

CodePudding user response:

Whether the firewall open??? Refresh the page is still 502?
  • Related