MapServer / mapcache

MapCache source code directory. Please submit pull requests to the 'main' branch.
https://mapserver.org/mapcache
Other
137 stars 96 forks source link

More trouble building Mapserver/mapcache against Nginx #155

Open AppreciateIT opened 7 years ago

AppreciateIT commented 7 years ago

Hi Thomas, thanks for this thread, it got me over some stumbling-blocks for this building of mapserver and mapcache for nginx on Ubuntu Xenial 16.04. Now I'm at the final make for nginx, and I'm stuck as follows:

$ /usr/local/src/nginx/nginx-1.10.2$ sudo make ... ... objs/addon/nginx/ngx_http_mapcache_module.o \ objs/ngx_modules.o \ -ldl -lpthread -lcrypt -lmapcache /usr/lib/x86_64-linux-gnu/libapr-1.so /usr/lib/x86_64-linux-gnu/libaprutil-1.so -lpcre -lcrypto -lcryp to -lz \ -Wl,-E objs/addon/nginx/ngx_http_mapcache_module.o: In function 'ngx_http_mapcache': /usr/local/src/mapcache/nginx/ngx_http_mapcache_module.c:299: undefined reference to 'mapcache_config_services_enabled' collect2: error: ld returned 1 exit status objs/Makefile:230: recipe for target 'objs/nginx' failed make[1]: [objs/nginx] Error 1 make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.10.2' Makefile:8: recipe for target 'build' failed make: [build] Error 2

Any clues gentlemen?

Cheers, Matt

tbonfort commented 7 years ago

works for me with the documented procedure. did you install mapcache itself ?

AppreciateIT commented 7 years ago

Yes, I did the mapcache install. I was hoping you could inform me if there is something I overlooked? A setting or configuration missing? Since the error is "Undefined reference to 'mapcache_config_services_enabled'" Am I missing something? The mapcache install seemed to work properly. I tried both nginx-1.10.2 and nginx-1.11.7. Same error.

Is it because I have no apache installed, the mapcache_config_services_enabled function or object is not able to find the mapcache.xml file?

pedros007 commented 7 years ago

FWIW, I use MapCache on Nginx without the compiled Nginx module. I run MapCache via FastCGI proxy & Supervisord. Works with stock Nginx & Supervisor available via Apt in debian:jessie. Likely works with Ubuntu 16.04. You'll need a configuration something like this:

Nginx conf:

server {
    listen 80;
    server_name localhost;
    location / {
    root /data/output;
    location ~ ^/mapcache(?<path_info>/.*|$) {
        set $url_prefix "/mapcache";
        error_page 404 = @fastcgi_mapcache;
    }

    location @fastcgi_mapcache {
        fastcgi_pass   unix:/var/run/mapcache.sock;
        fastcgi_param  QUERY_STRING     $query_string;
        fastcgi_param  REQUEST_METHOD   $request_method;
        fastcgi_param  CONTENT_TYPE     $content_type;
        fastcgi_param  CONTENT_LENGTH   $content_length;
        fastcgi_param  PATH_INFO        $path_info;
        fastcgi_param  SERVER_NAME      $server_name;
        fastcgi_param  SERVER_PORT      $server_port;
        fastcgi_param  SCRIPT_NAME      "/mapcache";
    }
}

Supervisor conf:

[fcgi-program:mapcache]
socket=unix:///var/run/mapcache.sock
socket_owner=www-data
socket_mode=0644
command=/usr/bin/mapcache.fcgi
numprocs=8
process_name=%(program_name)s_%(process_num)02d
autorestart=true
autostart=true
popensesame commented 7 years ago

The supervisor config did not work until I added the following line to the [supervisord] block in the supervisord.conf file:

environment=MAPCACHE_CONFIG_FILE="/path/to/mapcache-config.xml"

See this page on using mapcache with fastcgi