Configure a virtual host directly in nginx.conf to implement proxy forwarding and test OK, as follows:
server
{
listen 80;
listen 443;
server_name yangbai.com;
root /Library/WebServer/Documents/yangbai;
index index.php;
location / {
#root /Library/WebServer/Documents/youzan_oa/yzOA/src;
index index.html index.htm login.html;
}
location /oauth/token {
proxy_pass http://api.yangbai.com;
}
}
Test: http://yangbai.com/oauth/token successfully proxy to http://api.yangbai.com
But I extracted the above configuration and placed it under the servers directory at the same level as nginx.conf. I named yangbai.com.conf and the content was the same as above. Then nginx.conf was loaded through include servers/*;, but The test has never been able to be proxied. . . Brothers and sisters passing by, please take a look. I am not very familiar with nginx configuration.
Write the complete path of
include, for example: