ANXS / nginx

A fairly flexible and feature full Ansible role for the NGINX web server.
MIT License
151 stars 82 forks source link

unknown directive MainRule #12

Closed avanov closed 10 years ago

avanov commented 10 years ago

When nginx_install_method is set to package, the server is unable to start a daemon process, and an error log contains the following message:

2014/05/08 22:55:15 [emerg] 15255#0: unknown directive "MainRule" in /etc/nginx/naxsi_core.rules:13

Sample role config:

- hosts: default
  sudo: yes
  roles:
    - role: Ansibles.nginx
      nginx_install_method: package
      monit_protection: no
      nginx_sites:
        - server:
            name: default
            listen: 80
            server_name: "{{ ansible_ssh_host }}"
            location1:
              name: "/"
              alias: "/srv/www/"
              access_log: "off"
              expires: "1h"
              gzip: "on"
              gzip_http_version: "1.1"
              gzip_vary: "on"
              gzip_comp_level: "6"
avanov commented 10 years ago

Ok, I fixed it by explicitly setting nginx_source_modules_included: []. So, maybe it's worth renaming nginx_source_modules_included to something like nginx_modules_included if it's used in both install methods?

Dev-Dipesh commented 9 years ago

While compiling with source and default configuration on ubuntu I'm receiving the same error:

nginx: [emerg] unknown directive "MainRule" in /etc/nginx/naxsi_core.rules:19
Dev-Dipesh commented 9 years ago

Working for me now after updating the naxsi version and new rules.

nginx_naxsi_version: "0.54rc3"

Also it's important to change the order of naxsi in configure when you compile nginx, it should be at first to work as:

nginx_source_modules_included:
  naxsi_module: "--add-module=/tmp/naxsi-{{nginx_naxsi_version}}/naxsi_src"
  http_stub_status_module: "--with-http_stub_status_module"
  http_ssl_module: "--with-http_ssl_module"
  openssl: "--with-openssl=/tmp/openssl-{{ openssl_version }}"
  http_gzip_static_module: "--with-http_gzip_static_module"
  upload_progress_module: "--add-module=/tmp/nginx-upload-progress-module-{{nginx_upload_progress_version}}"
  headers_more_module: "--add-module=/tmp/headers-more-nginx-module-{{nginx_headers_more_version}}"
  http_auth_request_module: "--add-module=/tmp/ngx_http_auth_request_module-{{nginx_auth_request_release}}"
  http_echo_module: "--add-module=/tmp/echo-nginx-module-{{nginx_echo_version}}"
  google_perftools_module: "--with-google_perftools_module"
  ipv6_module: "--with-ipv6"
  http_real_ip_module: "--with-http_realip_module"
  http_spdy_module: "--with-http_spdy_module"
  http_perl_module: "--with-http_perl_module"
  ngx_pagespeed: "--add-module=/tmp/ngx_pagespeed-release-{{nginx_ngx_pagespeed_version}}-beta"

Another important lib required is httplib2 to make it work

sudo pip install httplib2