Allow Apache and nginx to support cross-domain access

Source: Internet
Author: User
1, how do I get Apache to support cross-domain access?
Steps:

    1. Modify the corresponding directory in the httpd.conf,windows is: C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf
    2. Remove LoadModule headers_module modules/mod_headers.so in front of the note
    3. Modify

      Switch

      That
</>    noneRequireall 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:


   
    <cross-domain-policy><allow-access-fromdomain="*" />
   
    cross-domain-policy>

The result is:

Note: The default/usr/local/nginx/html/crossdomain.xml is not present.

The above describes the Apache and Nginx support cross-domain access, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.