Configure
http {
...
in nginx.conf add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow- Methods GET, POST, OPTIONS;
...
}
This way you can support cross-domain requests for GET, POST, OPTIONS
You can also add_header Access-Control-Allow-Origin http://test. 51testing.com; --Specify the allowed URL;
Reprint address: http://www.51testing.com/html/96/215196-829360.html
The above introduces the configuration of cross-domain support function in nginx, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.