[solved] Captive Portal and nginx

  • Hi all.

    After upgrade to beta, the captive portal service doesn´t get running due this error :

    /status_services.php: The command '/usr/local/sbin/nginx -c /var/etc/nginx-portalwifigratuito-CaptivePortal.conf' returned exit code '1', the output was 'nginx: [emerg] invalid condition "$http_host" in /var/etc/nginx-portalwifigratuito-CaptivePortal.conf:34'

    and the section of the file  /var/etc/nginx-portalwifigratuito-CaptivePortal.conf:

    server {
                    listen 8002;
                    listen [::]:8002;
                    limit_conn addr 10;

    if ($http_host = {
                            set $cp_redirect no;
                    if ($http_host = ) {                            <<–- line 34
                            set $cp_redirect no;

    I guess there is something wrong in the function "system_generate_nginx_config" that generates this config file.

      JC Bilhega

  • Developer Netgate Administrator

    Can you share <captiveportal>block of your config.xml?</captiveportal>

  • Developer Netgate Administrator

    I pushed a fix to prevent it to happen

  • Thanks Renato!!! I´ll try it asap. If you still need the <captiveportal>block, let me know.</captiveportal>

  • Fixed. Thanks again.

Log in to reply