My local environment is LNMP
There are now 2 sites www.aa.com The other is api.aa.com is mainly to provide API interface
I am now www.aa.com this site to invoke the Api.aa.com interface. I'm calling through PHP's Curl mode.
But always prompt www.aa.com always loaded, if I set timeout time to 1s, is ok, meaning I can not get to api.aa.com this domain name below the return value
If I change the local environment to Apache, then I will not encounter the above problems ... I pre-release the test environment without encountering this problem ...
Preliminary conjecture: Is not nginx inside a PHP process is not always in the suspended state? My local is win development environment does not look at other processes and the like is also inconvenient, so ask for advice on this problem solving method 3q
Reply content:
My local environment is LNMP
There are now 2 sites www.aa.com The other is api.aa.com is mainly to provide API interface
I am now www.aa.com this site to invoke the Api.aa.com interface. I'm calling through PHP's Curl mode.
But always prompt www.aa.com always loaded, if I set timeout time to 1s, is ok, meaning I can not get to api.aa.com this domain name below the return value
If I change the local environment to Apache, then I will not encounter the above problems ... I pre-release the test environment without encountering this problem ...
Preliminary conjecture: Is not nginx inside a PHP process is not always in the suspended state? My local is win development environment does not look at other processes and the like is also inconvenient, so ask for advice on this problem solving method 3q
The solution to the problem is to test. You can use the trial httping locally to do a separate api.aa.com for the appropriate time test. If there is no performance test, you can also use PHP, call Get_content_file to do. Time stamp before and after printing
If it is api.aa.com the corresponding time is slow to test the simple index.php page inside the Echo statement words. Do the test. If you can't pass the test, it's basically a server configuration problem.
If you pass, look for api.aa.com database calls, compare simple data calls, and then do business testing.
In addition landlord do not suspect is curl and nginx problem, if you have to suspect also do the corresponding test, pay attention to test method. Nginx support concurrency, unless you set the concurrency is too small, or the Linux system open the number of files is too small. Curl itself is a PHP module that is not part of the PHP kernel and is a PHP-hosted process.
See if it's a domain name resolution.
Try to be a host.
Change/etc/hosts
127.0.0.1 api.aa.com
Try today, the code to test environment OK test environment is nginx, the cause of the error should be local environment win is no php-fpm another local switch to Apache all OK