Ubuntu——apache如何解决跨域资源访问
发布时间:2020-05-22 12:08:28 所属栏目:Ubuntu 来源:互联网
导读:参考文档:http://blog.csdn.net/ownfire/article/details/46707229 1.sudo cd /etc/apache2/sites-available/ 2. sudogedit000-default.conf 编辑添加 LoadModuleheaders_modulemodules/mod_headers.so HeadersetA
|
参考文档:http://blog.csdn.net/ownfire/article/details/46707229
HeadersetAccess-Control-Allow-Origin* 如下: <VirtualHost*:80> LoadTileConfigFile/usr/local/etc/renderd.conf ModTileRenderdSocketName/var/run/renderd/renderd.sock LoadModuleheaders_modulemodules/mod_headers.so #Timeoutbeforegivingupforatiletoberendered ModTileRequestTimeout0 #Timeoutbeforegivingupforatiletoberenderedthatisotherwisemissing ModTileMissingRequestTimeout30 #TheServerNamedirectivesetstherequestscheme,hostnameandportthat #theserverusestoidentifyitself.Thisisusedwhencreating #redirectionURLs.Inthecontextofvirtualhosts,theServerName #specifieswhathostnamemustappearintherequest'sHost:headerto #matchthisvirtualhost.Forthedefaultvirtualhost(thisfile)this #valueisnotdecisiveasitisusedasalastresorthostregardless. #However,youmustsetitforanyfurthervirtualhostexplicitly. #ServerNamewww.example.comServerAdminwebmaster@localhost DocumentRoot/var/www/html HeadersetAccess-Control-Allow-Origin* #Availableloglevels:trace8,...,trace1,debug,info,notice,warn, #error,crit,alert,emerg. #Itisalsopossibletoconfiguretheloglevelforparticular #modules,e.g. #LogLevelinfossl:warn ErrorLog${APACHE_LOG_DIR}/error.log CustomLog${APACHE_LOG_DIR}/access.logcombined #Formostconfigurationfilesfromconf-available/,whichare #enabledordisabledatagloballevel,itispossibleto #includealineforonlyoneparticularvirtualhost.Forexamplethe #followinglineenablestheCGIconfigurationforthishostonly #afterithasbeengloballydisabledwith"a2disconf". #Includeconf-available/serve-cgi-bin.conf </VirtualHost> #vim:syntax=apachets=4sw=4sts=4srnoet 3.重启Apache serviceapache2restart 测试跨域访问即可 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ubuntu-16.04 – libstdc .so.6:找不到版本`GLIBCXX_3.4.2
- 如何更新/替换ubuntu16.04内核
- 在Ubuntu中添加和删除PPA的软件源
- ubuntu上Caffe使用OpenBLAS多线程加速
- Ubuntu Apache配置以及cgi配置方法
- ubuntu 下出现E: Sub-process /usr/bin/dpkg returned an e
- ubuntu – 如何链接到cppunit?
- ubuntu14.04 nginx报upstream timed out 问题原因,解决办法
- 如何在没有X的情况下在ubuntu上安装mercurial
- Ubuntu14.04下配置测试Faster R-CNN+Caffe(Matlab+CPU)目
