Gmeister4
Gmeister4

Reputation: 755

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)

Here is my 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.

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! Thanks in advance.

Upvotes: 4

Views: 8418

Answers (3)

dastan
dastan

Reputation: 930

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>

Upvotes: -1

Gmeister4
Gmeister4

Reputation: 755

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).

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:

<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!

Upvotes: 0

pep
pep

Reputation: 59

Replace: Allow from all by Require all granted

<Directory /www/mysite>
    Allow from All
</Directory>

<Directory /www/mysite>
    Require all granted
</Directory>

Upvotes: 5

Related Questions