During the development stage, the front-end server is localhost:8080, and the back-end server is localhost:8088, which involves cross-domain, so nginx is used as a reverse proxy to convert all http requests starting with http://localhost:8080/api into http://localhost:8088/api, nginx configuration is as follows
The result is always 404
Use postman to test the backend interface and it shows normal
Check the task manager, nginx is running
nginx’s access log has no record, and there is no record in the error log. The following is the last content of the error log
I don’t know what went wrong
One missing
/api
According to the request of the subject
Need to put
http://localhost:8080/api
=>http://localhost:8088/api
But
The implementation is
http://localhost:8080/api
=>http://localhost:8088/
http://localhost:8080/api
=>http://localhost:8088/
所以需要访问
http://localhost:8080/api/api
So you need to accesshttp://localhost :8080/api/api
to access the real endpoint.Change to
That’s it
Isn’t your server_name 127.0.0.1?
localhost
不一定就代表127.0.0.1
right?