好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > 解決nginx/apache靜態資源跨域訪問問題詳解

解決nginx/apache靜態資源跨域訪問問題詳解

熱門標簽:廣東如何申請400電話 燃氣管線地圖標注顏色 哈爾濱400電話去哪辦理 寧波400電話辦理對企業的意義 400電話申請要什么條件 話術外呼系統 i智能電話機器人yeta 北京人工外呼系統廠家 西柏坡地圖標注

1. apache靜態資源跨域訪問

找到apache配置文件httpd.conf

找到這行

#LoadModule headers_module modules/mod_headers.so

把#注釋符去掉

LoadModule headers_module modules/mod_headers.so

目的是開啟apache頭信息自定義模塊

在獨立主機配置文件中新增header

Header set Access-Control-Allow-Origin *

例如:

<VirtualHost *:88>
 ServerAdmin admin@example.com
 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

意思是對這個域名的資源進行訪問時,添加一個頭信息

重啟apache

service httpd restart

2. nginx靜態資源允許跨域訪問

同理 找到相應域名配置文件

在server模塊中添加配置:

add_header ‘Access-Control-Allow-Origin' ‘*';

例:

server {
    listen    80;
    add_header 'Access-Control-Allow-Origin' '*';
    location /Roboto/ {
      root  /home/images;
      autoindex on;
    }
  }

nginx重載

./nginx -s reload

通過以上方法配置完后,再次跨域訪問靜態資源就沒有問題了

以上既是nginx/apache靜態資源允許跨域訪問解決方法

標簽:襄陽 西藏 阜陽 珠海 開封 湘潭 巴中 張家口

巨人網絡通訊聲明:本文標題《解決nginx/apache靜態資源跨域訪問問題詳解》,本文關鍵詞  解決,nginx,apache,靜態,資源,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《解決nginx/apache靜態資源跨域訪問問題詳解》相關的同類信息!
  • 本頁收集關于解決nginx/apache靜態資源跨域訪問問題詳解的相關信息資訊供網民參考!
  • 推薦文章