4

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.

Gmeister4
  • 754
  • 10
  • 19
  • Status error code `403` `forbidden` isn't a file system access violation. It is an Authorization violation. Please check if your directory has `.htaccess` file. – alvits May 27 '14 at 21:21
  • Shouldn't the `DocumentRoot` and `Directory` be the same folder? – Whymarrh May 27 '14 at 21:25
  • I dont think it does have a .htaccess file, I havent seen one located on the server. Where should it be/ what sound it look like? I dont think the file directory needs to be the same as its not the static html I want to access, it's a file called 'interpreter' located in /srv/osm3s/cgi-bin/ – Gmeister4 May 27 '14 at 21:32
  • Is `interpreter` file readable-executable? Is `selinux` in enforcing mode? If `selinux` is enforcing, make sure that apache is allowed to access the folder and allowed to read and execute `interpreter` file. – alvits May 27 '14 at 22:30
  • seems you need `SetHandler` there. `SetHandler cgi-script` – Deadooshka May 28 '14 at 00:37
  • Verify file permissions recursively (Unix based systems). chmod -R 755 /srv/osm3s/ (on root dir). Directories at least should be 755; files should be 644 – Alejandro Quiroz Jan 30 '15 at 20:24
  • did you brought it to work? I'm struggling with the exact same problem. I tried all permission options but its not working. – Kingalione Feb 24 '15 at 15:27
  • I did get it working @Kingalione , see my answer below – Gmeister4 Feb 24 '15 at 18:40

3 Answers3

5

Replace: Allow from all by Require all granted

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

<Directory /www/mysite>
    Require all granted
</Directory>
pep
  • 59
  • 2
0

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!

Gmeister4
  • 754
  • 10
  • 19
-1
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>
dastan
  • 892
  • 10
  • 17