[英]Apache 2.4.7 403 Forbidden Error
I'm trying to install the overpass api as a web server with apache ( http://wiki.openstreetmap.org/wiki/Overpass_API/install ) 我正在尝试使用apache安装overpass api作为Web服务器( http://wiki.openstreetmap.org/wiki/Overpass_API/install )
Here is my 000-default.conf 这是我的000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ExtFilterDefine gzip mode=output cmd=/bin/gzip
DocumentRoot /root/osm-3s_v0.7.4/html
# This directive indicates that whenever someone types http://www.mydomain.com/api/
# Apache2 should refer to what is in the local directory [YOUR_EXEC_DIR]/cgi-bin/
ScriptAlias /api/ /srv/osm3s/cgi-bin/
# This specifies some directives specific to the directory: [YOUR_EXEC_DIR]/cgi-bin/
<Directory "/srv/osm3s/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
#SetOutputFilter gzip
#Header set Content-Encoding gzip
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/access.log combined
However when I try to run the command: 但是当我尝试运行命令时:
http://175.33.148.57/api/interpreter?data=%3Cprint%20mode=%22body%22/%3E
I get the 403 Forbidden error. 我收到403 Forbidden错误。
I have already done 我已经完成了
chmod 777 /srv/osm3s/cgi-bin/
But nothing seems to work. 但似乎没有任何效果。
Please help, Ive been stuck on this for 3 days now! 请帮助,我已经坚持了3天了! Thanks in advance. 提前致谢。
Replace: Allow from all by Require all granted 替换:全部允许需要全部授予
<Directory /www/mysite>
Allow from All
</Directory>
<Directory /www/mysite>
Require all granted
</Directory>
Here is how I solved this problem for anyone who might have a similar one: 以下是我为可能有类似问题的人解决此问题的方法:
It seemed the problem came from where I installed the overpass installation ($EXEC_DIR). 似乎问题来自我安装立交桥安装的地方($ EXEC_DIR)。
So I had to change the install directories to: 所以我不得不将安装目录更改为:
$EXEC_DIR /var/www/osm/
$DB_DIR /var/www/osm/db/
$PLANET_FILE /var/www/osm/planet.osm.bz2
$REPLICATE_DIR /var/www/osm/rep/
Giving the resulting default.conf
: 给出生成的default.conf
:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ExtFilterDefine gzip mode=output cmd=/bin/gzip
DocumentRoot /root/osm-3s_v0.7.4/html
# This directive indicates that whenever someone types http://www.example.com/api/
# Apache2 should refer to what is in the local directory [YOUR_EXEC_DIR]/cgi-bin/
ScriptAlias /api/ /var/www/osm/cgi-bin/
# This specifies some directives specific to the directory: [YOUR_EXEC_DIR]/cgi-bin/
<Directory "/var/www/osm/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
#SetOutputFilter gzip
#Header set Content-Encoding gzip
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
I tried and tried but couldn't get it working with the old dir. 我尝试过并试过但是无法让它与旧的目录一起工作。 Good luck! 祝好运!
try this as it is. don't add Order allow,deny or others
AddHandler cgi-script .cgi .py
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
Allow from all
</Directory>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.