1. Apache static resource cross-domain access Find the Apache configuration file httpd.conf Find this line Remove the # comment character The purpose is to enable the Apache header information custom module Add a new header to the standalone host configuration file For example: <VirtualHost *:88> ServerAdmin [email protected] DocumentRoot "****************" ServerName www.jb51.com Header set Access-Control-Allow-Origin * ErrorLog "***********" CustomLog "****************************" common <Directory "**************"> SetOutputFilter DEFLATE Options FollowSymLinks ExecCGI Require all granted AllowOverride All Order allow, deny Allow from all DirectoryIndex index.html index.php </Directory> </VirtualHost> ApacheCopy This means adding a header when accessing resources on this domain name. Restart apache 2. nginx static resources allow cross-domain access Similarly, find the corresponding domain name configuration file Add configuration in the server module: example: server { listen 80; add_header 'Access-Control-Allow-Origin' '*'; location /Roboto/ { root /home/images; autoindex on; } } nginx reload After configuring through the above method, there is no problem in accessing static resources across domains again The above is the solution to allow cross-domain access to nginx/apache static resources You may also be interested in:
|
<<: Summary of Binlog usage of MySQL database (must read)
>>: JavaScript uses setTimeout to achieve countdown effect
There are various environmental and configuration...
This article shares the specific code of js to im...
Table of contents 1. Installation 2. Use Echarts ...
I believe everyone is familiar with the trashcan,...
Preface Recently, I encountered a requirement at ...
for loop The for loop loops through the elements ...
Pure CSS3 makes a butterfly flapping its wings, s...
1. The significance of persistent statistical inf...
When I installed php56 with brew on mac , I encou...
This article shares the specific code for impleme...
My original intention was to encapsulate the $not...
This case is based on CentOS 7 system Suitable fo...
There are many tags in XHTML, but only a few are ...
Table of contents Preface Demonstration effect HT...
Let me first introduce to you that the node proce...