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
Mysql slow query explanation The MySQL slow query...
By default, Docker runs over a non-networked UNIX...
This article records the installation tutorial of...
Original article, please indicate the author and ...
The pitfalls 1. Many tutorials on the Internet wr...
Table of contents Preface Global Lock Table lock ...
When writing HTML code, the first line should be ...
1. Check whether the MySQL service is started. If...
Table of contents 1. Initialize the map 2. Map Po...
describe This article introduces a method to impl...
Table of contents 1. MySQL replication related co...
Preface: When designing a table in MySQL, MySQL o...
Table of contents MySQL result sorting - Aggregat...
Web page WB.ExecWB control printing method Copy c...
Busybox: A Swiss Army knife filled with small com...