如何为 Apache httpd 服务器启用 CORS?(分步过程)
我想知道是否有人可以帮助我在我的 Apache Web 服务器上设置 CORS.我希望有一个循序渐进的过程,因为许多在线网站都在告诉我不同的事情.比如我需要对我的 httpd.conf
或 ssl.conf
文件做什么,我的 .htaccess
文件放在哪里等
I was wondering if anybody can help me set up CORS on my Apache web server. I would appreciate a step-by-step process because many sites online are telling me different things. Like what do I need to do on my httpd.conf
or ssl.conf
files, where to put my .htaccess
file, etc.
上面的答案是正确的,放在 httpd.conf
里面.这应该更改为您设置的任何文档根目录.
The above answer is correct and put Inside the httpd.conf
. This should be changed to whatever you set Document Root.
在 Ubuntu 上,httpd.conf
位于目录 /etc/apache2.apache2.conf
也位于/etc/apache2.
On Ubuntu, httpd.conf
is located in the directory /etc/apache2. apache2.conf
is also located in /etc/apache2.
在CENTOS 6 httpd.conf
路径/etc/httpd/conf/httpd.
<Directory "/var/www/html">
Header set Access-Control-Allow-Origin "*"
</Directory>