Does nginx proxy forwarding fail?
大家讲道理
大家讲道理 2017-05-16 17:17:00
0
1
644

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.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
習慣沉默

Write the complete path of

include, for example:

include /usr/local/nginx/conf.d/*.ngx.conf;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template