woodRock / super-telegram

We are migrating an existing Web Map Service (WMS) to a different server. The existing services uses Apache, Postgres, Postgis (psql extention), and Mapserver. The new version of the server has an updated version of both Mapserver and Postgres installed. Between the major versions of Mapserver some of the syntax from the existing Mapfiles is now deprecated.
0 stars 0 forks source link

Configure Apache #7

Closed woodRock closed 4 years ago

woodRock commented 4 years ago

We have the cgi-bin installed. However the Apache2 server must be configured to load it properly.

Apache2 needs to know which files are executable and are allowed to be executed. These are the bash scripts in the /usr/lib/cgi-bin directory. These scripts hide the internal file structure of the server from the outside world for added security.

woodRock commented 4 years ago

Here is a tutorial example that shows how to configure Apache2 and the cgi-bin to work properly.

woodRock commented 4 years ago

First we must enable the cgi.load mod in the Apache2 configuration files.

This can be done with the following command.

$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/cgi.load

Then we must restart the Apache2 service before this will work.

$ sudo service apache2 reload
woodRock commented 4 years ago

We can verify that this works by visiting the following url for the acoustic mapfile.

Previously the Apache2 server would display this page as a text file of the contents of the script. It did not recognize that the script was execrable for the cgi-bin.

Now we see that the cgi-bin is working and is able to execute the bash scripts within the mapserv directory.

woodRock commented 4 years ago

In order for all the URLs for the Apache2 server to work we needed to make the header scripts for each Mapfile executable. Our cgi-bin required permission to run these executable.

We created a script which found all of the files that contained a bash she-bang and changed the permissions for each. This was done with the following commnad:

chmod a+x

Now the cgi-bin can execute these scripts. And the URL for each Mapfile works on the Server.