[mapserver-users] Mapserver install - Mac OS X and safari

Puneet Kishor punk.kish at gmail.com
Mon Jan 16 20:21:16 EST 2012


On Jan 16, 2012, at 7:06 PM, M Badar wrote:

> Thanks, everyone.
> 
> With /etc/hosts set to:
> 
> 127.0.0.1       localhost   localhost


You are doing it all wrong. You shouldn't have to mess with /etc/hosts at all, definitely not with regards to the localhost entry. In fact, it says very clearly

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost




> 
> and accessing the URL:
> 
> http://localhost.com/cgi-bin/mapserv

> 
> I get the error:
> 
> # safari can't open the page "http://localhost.com/cgi-bin/mapserv" because
> the server
> # unexpectedly dropped the connection.
> 

localhost.com is an actual private domain, not the loopback interface of your own computer.


> and when the URL is accessed this way (leaving /etc/hosts as shown above):
> 
> http://localhost/cgi-bin/mapserv
> 
> I get the error:
> 
> Not Found
> 
> The requested URL /cgi-bin/mapserv was not found on this server.
> 
> At this point I'm 90% sure the problem lies between safari and apache.
> Maybe it's time for a reference manual on apache.  Does anyone have any
> titles they would like to recommend?


The apache docs at http://httpd.apache.org is pretty good. But, since you are using Mac OS X, you can simply use apache that comes with it. Just make sure the ScriptAlias directory is set to the cgi-bin directory you are hoping to serve mapserv from.


However, if you want to use your own installed apache (it seems that is what you are using because you provided /usr/local/apache2 to your mapserv config), configure it properly. Its config file is at /usr/local/apache2/conf/httpd.conf

Just make sure that your Mac's built in apache is not also running (go to System Preferences... Sharing... Web Sharing). You can't have two apaches running at the same time, well, at least not glommed on the same default port 80.

Hope this helps.


> 
> Mike
> 
> On Mon, Jan 16, 2012 at 4:14 PM, John Cartwright <
> john.c.cartwright at comcast.net> wrote:
> 
>> Did you try just "http://localhost/cgi-bin/mapserv"  ?
>> 
>> --john
>> 
>> On Jan 16, 2012, at 1:11 PM, M Badar wrote:
>> 
>> Greetings,
>> 
>> New user to the list.  I am installing mapserver on my MacBook Pro.  The
>> installation has progressed without error until I attempt to call the
>> 'mapserv' cgi executable from safari; it returns the following error after
>> running the final check as described in the documentation:
>> 
>> # Page 40, MapServer Documentation, Release 6.0.1; 4.1.8 Installation -
>> The basic install.
>> 
>> # This is the final test to ensure mapserver is installed and functioning
>> correctly.
>> # When attempting to access the test URL, safari returns the following
>> error:
>> 
>> # Test URL: http://localhost.com/cgi-bin/mapserv
>> 
>> # Safari error:
>> 
>> # safari can't open the page "http://localhost.com/cgi-bin/mapserv"
>> because the server
>> # unexpectedly dropped the connection.
>> 
>> Mapserver version: 6.0.1
>> Mac OS X version: 10.6.8
>> Safari version: 5.1.2
>> 
>> My suspicion is the error is related to how mapserver and apache are
>> communicating; however, not being apache literate, I don't know where to
>> begin diagnosing the connection problem.  I ran a syntax check on the
>> httpd.conf file and it returned the following:
>> 
>> Michael-Badars-MacBook-Pro:bin bobby$ apachectl -t
>> httpd: Could not reliably determine the server's fully qualified domain
>> name, using
>> Michael-Badars-MacBook-Pro.local for ServerName
>> Syntax OK
>> Michael-Badars-MacBook-Pro:bin bobby$
>> 
>> The above error is returned regardless if I am connected to the internet
>> via a wireless or hardwired connection.
>> 
>> Listed below are details regarding my installation.
>> 
>> Thanks in advance for any help you can provide.
>> 
>> Mike Badar
>> 
>> #
>> # Map Server 6.0.1 "configure" script.
>> #
>> 
>> # Author: Mike Badar
>> # Date: 29 December, 2011
>> # Version: 3
>> 
>> ./configure                                                       \
>>               --with-curl-config=/usr/local/bin/curl-config     \
>>               --with-gdal=/usr/local/bin/gdal-config            \
>>               --with-geos=/usr/local/bin/geos-config            \
>>               --with-ogr=/usr/local/bin/gdal-config             \
>>               --with-postgis=/usr/local/pgsql/bin/pg_config     \
>>               --with-xml2-config=/usr/local/bin/xml2-config     \
>>                                                                 \
>>               --with-agg=/usr/local                             \
>>               --with-freetype=/usr/local                        \
>>               --with-gd=/usr/local                              \
>>               --with-httpd=/usr/local/apache2/bin/httpd         \
>>               --with-jpeg=/usr/local                            \
>>               --with-proj=/usr/local                            \
>>               --with-tiff=/usr/local                            \
>>                                                                 \
>>               --with-wfsclient                                  \
>>               --with-wmsclient                                  \
>>               --with-threads                                    \
>>               --with-wcs                                        \
>>                                                                 \
>>               --enable-debug
>> 
>> #
>> # Mapserver version.
>> #
>> Michael-Badars-MacBook-Pro:cgi-bin bobby$ ./mapserv -v
>> MapServer version 6.0.1 \
>> 
>>         OUTPUT=GIF \
>>         OUTPUT=PNG \
>>         OUTPUT=JPEG \
>> 
>>         SUPPORTS=PROJ \
>>         SUPPORTS=AGG \
>>         SUPPORTS=FREETYPE \
>>         SUPPORTS=ICONV \
>>         SUPPORTS=WMS_SERVER \
>>         SUPPORTS=WMS_CLIENT \
>>         SUPPORTS=WFS_CLIENT \
>>         SUPPORTS=WCS_SERVER \
>>         SUPPORTS=THREADS \
>>         SUPPORTS=GEOS \
>> 
>>         INPUT=OGR \
>>         INPUT=GDAL \
>>         INPUT=SHAPEFILE
>> 
>> #
>> # Page 39, MapServer Documentation, Release 6.0.1; Step 9 test.
>> #
>> Michael-Badars-MacBook-Pro:cgi-bin bobby$ ./mapserv
>> This script can only be used to decode form results and
>> should be initiated as a CGI process via a httpd server.
>> Michael-Badars-MacBook-Pro:cgi-bin bobby$
>> 
>> #
>> # Apache version.
>> #
>> Michael-Badars-MacBook-Pro:bin bobby$ apachectl -v
>> Server version: Apache/2.2.20 (Unix)
>> Server built:   Sep 12 2011 17:42:56
>> Michael-Badars-MacBook-Pro:bin bobby$
>> 
>> #
>> # /usr/local/apache2/conf/httpd.conf; mapserver additions.
>> #
>> 
>> # ServerRoot
>> ServerRoot "/usr/local/apache2"
>> 
>> # Apache port.
>> Listen 80
>> 
>> # Cgi directory; ScriptAlias; Log file.
>> <Directory /usr/local/apache2/cgi-bin>
>> Options +ExecCGI +FollowSymLinks
>> </Directory>
>> 
>> ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/
>> 
>> #
>> # Log file.
>> #
>> ScriptLog logs/cgi_log
>> ErrorLog "logs/error_log"
>> 
>> # Display user 'www'
>> 
>> Michael-Badars-MacBook-Pro:~ root# dscl . -read /Users/www
>> AppleMetaNodeLocation: /Local/Default
>> AuthenticationAuthority: ;ShadowHash;
>>                         ;Kerberosv5;
>>                         ;_www at LKDC
>> :SHA1.458017A5A4386C409A25B49470E08467DC7022AF
>> 
>> ;LKDC:SHA1.458017A5A4386C409A25B49470E08467DC7022AF;
>> GeneratedUID: FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000046
>> NFSHomeDirectory: /Library/WebServer
>> Password: ********
>> PrimaryGroupID: 70
>> RealName:
>> World Wide Web Server
>> RecordName: _www www
>> RecordType: dsRecTypeStandard:Users
>> UniqueID: 70
>> UserShell: /usr/bin/false
>> Michael-Badars-MacBook-Pro:~ root#
>> 
>> # Check /usr/local/apache2/conf/httpd.conf for syntax errors.
>> 
>> Michael-Badars-MacBook-Pro:bin bobby$ apachectl -t
>> httpd: Could not reliably determine the server's fully qualified domain
>> name, using
>> Michael-Badars-MacBook-Pro.local for ServerName
>> Syntax OK
>> Michael-Badars-MacBook-Pro:bin bobby$
>> 
>> # Start apache and check for the existence of the httpd process.
>> 
>> Michael-Badars-MacBook-Pro:logs root# apachectl start
>> Michael-Badars-MacBook-Pro:logs root# ps -ajx|grep httpd
>> root       526     1   526 59ff000    0 Ss     ??    0:00.18
>> /usr/sbin/httpd -D FOREGROUND
>> _www       527   526   526 59ff000    0 S      ??    0:00.00
>> /usr/sbin/httpd -D FOREGROUND
>> root       529   391   528 5a00110    2 S+   s001    0:00.00 grep httpd
>> Michael-Badars-MacBook-Pro:logs root#
>> 
>> # Page 40, MapServer Documentation, Release 6.0.1; 4.1.8 Installation -
>> The basic install.
>> # This is the final test to ensure mapserver is installed and functioning
>> correctly.
>> # When attempting to access the test URL, safari returns the following
>> error:
>> 
>> # Test URL: http://localhost.com/cgi-bin/mapserv
>> 
>> # Safari error:
>> 
>> # safari can't open the page "http://localhost.com/cgi-bin/mapserv"
>> because the server
>> # unexpectedly dropped the connection.
>> 
>> # Port 80 /etc/services
>> 
>> http             80/udp     www www-http # World Wide Web HTTP
>> http             80/tcp     www www-http # World Wide Web HTTP
>> 
>> # /etc/services
>> 
>> Michael-Badars-MacBook-Pro:~ bobby$ cat /etc/hosts
>> ##
>> # Host Database
>> #
>> # localhost is used to configure the loopback interface
>> # when the system is booting.  Do not change this entry.
>> ##
>> # 127.0.0.1 localhost
>> #
>> # This line was added in an attempt to diagnose why apache is dropping
>> connections
>> # to mapserver.
>> #
>> 127.0.0.1       localhost.localdomain   localhost # Mapserver diagnostic
>> line.
>> 
>> 
>> 255.255.255.255 broadcasthost
>> ::1             localhost
>> fe80::1%lo0 localhost
>> Michael-Badars-MacBook-Pro:~ bobby$_______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
>> 
>> 
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> 
>> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list