Request the method of Apache server configuration across domains

  • 2020-05-15 03:28:52
  • OfStack

1. Modify the server configuration file


<Directory /www/web/yuming.com/public_html/>
 Options FollowSymLinks
 AllowOverride All
 Require all granted
 Header set Access-Control-Allow-Origin *
</Directory>

2. Edit httpd. conf

Find the following line and remove # to enable the apache header custom module


#LoadModule headers_module modules/mod_headers.so

The key content


Access-Control-Allow-Origin *

This means to add 1 header when accessing the resources of the domain name

Finally, restart the server to take effect


Related articles: