1, how do I get Apache to support cross-domain access ?
Steps:
- Modify the corresponding directory in the httpd.conf,windows is: C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf
- Remove LoadModule headers_module modules/mod_headers.so in front of the note
- Modify
Switch
That
</> none Requireall granted Headerset Access-Control-Allow-Origin*</Directory>
If you use the graphical interface to open the Headers_module module, note the sequence of steps
(1) First use the graphical interface to open the Headers_module module function;
(2) After modifying the httpd.conf configuration file, add header set Access-control-allow-origin *
If the order is wrong, you can't start httpd service.
2, how to make Nginx support cross-domain ?
1, enter the Nginx HTML directory
Vim.. /crossdomain.xml
Specific path:/usr/local/nginx/html/crossdomain.xml
2, add in Crossdomain.xml:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy><allow-access-from domain="*" /></cross-domain-policy>
The result is:
Note: The default/usr/local/nginx/html/crossdomain.xml is not present.
Allow Apache and nginx to support cross-domain access