0

I got an Apache and MapServer bundle. On MapServer I made a WMS service and connect it to clients (Leaflet, QGIS etc.) with an URL like this:

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/example/polt.map

In MapServer documentation I found that Apache can convert this URL in something like this:

http://localhost/mywms

In httpd.conf I see that rewrite module is on

LoadModule rewrite_module modules/mod_rewrite.so

Also I had added this block

<Directory C:\ms4w\apps\htdocs>
  AllowOverride All
</Directory>

After I created .htaccess file in C:\ms4w\apps\htdocs

RewriteEngine on
RewriteRule wmsmap?(.*) /cgi-bin/mapserv?map=C:/ms4w/apps/example/polt.map&$1

After I restarted Apache. But when I try to open with URL

http://localhost/wmsmap?layer=Green&mode=map

I got

The requested URL /wmsmap was not found on this server.

Where is my mistake?

UPDATE

I had removed Directory block what I added in httpd.conf file. And edit default block so I got:

<Directory "/ms4w/Apache/htdocs">
  Options Indexes FollowSymLinks
  AllowOverride All
  #Require all granted
</Directory>

After I put .htaccess file in /ms4w/Apache/htdocs. And now I got another error on same URL:

msSaveImage(): Unable to access file. Failed to create output file (/tmp/WMS15201604824704.png).

What permission do I need?

  • @JGH oh, sorry. Just a typo in copypaste. – Kliver Max Mar 4 '18 at 14:37
  • Mode=map& doesn't give you a WMS response – nmtoken Mar 12 '18 at 8:39
  • Windows needs modify access to what ever folder location you have mapped as /tmp. – nmtoken Nov 12 '18 at 8:43
1

This works for me, but I don't know how to use .htaccess file too.

Alias /wmsmap "d:/ms4w/Apache/cgi-bin/mapserv.exe"
<Location /wmsmap >
   SetHandler cgi-script
   Options ExecCGI
   SetEnv MS_MAPFILE "d:/ms4w/apps/cgi-viewer/map/wmsdemo1.map"
</Location>
  • .htaccess settings don't affect the mapping – nmtoken Nov 12 '18 at 8:44
0

Just create an alias on Apache. Like so:

<VirtualHost *> 
ServerName example.com
DocumentRoot /var/www/html/mjp

Alias /ncn "/var/www/html/ncn"

<Directory "/var/www/html/ncn">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.