Giter Club home page Giter Club logo

nginx's Introduction

nginx Cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Installs nginx from package and sets up configuration handling similar to Debian's Apache2 scripts.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If youโ€™d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Cookbooks

The following cookbooks are direct dependencies because they're used for common "default" functionality.

  • ohai for setting up the ohai plugin

Platforms

The following platforms are supported and tested with Test Kitchen:

  • Amazon Linux 2
  • CentOS 7
  • Debian 8+
  • Fedora 30
  • openSUSE Leap 15
  • Ubuntu 16.04+

Other Debian and RHEL family distributions are assumed to work.

Chef

  • Chef 14+

Resources

Usage

This cookbook is now resource-based. Use the resources described above in wrapper cookbooks or recipes.

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

nginx's People

Contributors

aespinosa avatar artiom avatar axelrtgs avatar axos88 avatar bmhughes avatar brandonmartin avatar cwebberops avatar damacus avatar dwradcliffe avatar eherot avatar fernandoaleman avatar jalberto avatar jimryan avatar josephholsten avatar jujugrrr avatar kitchen-porter avatar lnxchk avatar majormoses avatar markgibbons avatar miketheman avatar powerschill avatar ramereth avatar renovate[bot] avatar reset avatar sethvargo avatar tas50 avatar trobrock avatar xorima avatar xorimabot avatar zmaupin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx's Issues

rake installation conflict with passenger recipe

Hi,

I install rbenv before nginx::passenger and I run into this failure below where the gem_package 'rake' conflicts with rake already installed. I can create a PR but wanted to create this first to get feedback on an implementation solution. I would either add the force option or make a flag for setting options. Thoughts?

           Error executing action `install` on resource 'gem_package[rake]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '1'
           ---- Begin output of /opt/rbenv/shims/gem install rake -q --no-rdoc --no-ri -v "10.3.2" ----
           STDOUT:
           STDERR: ERROR:  Error installing rake:
            "rake" from rake conflicts with /opt/rbenv/versions/2.1.4/bin/rake
           ---- End output of /opt/rbenv/shims/gem install rake -q --no-rdoc --no-ri -v "10.3.2" ----

how to make nginx config changes stick without rebooting?

After running the nginx recipe, I write some config rules to /etc/nginx/conf.d. These changes don't take effect until I reboot the system. "sudo nginx -s reload" fails claiming it can't find nginx.pid. How can I get nginx to see the config changes?

Errno::EPIPE: Broken pipe for ohai[custom_plugins]

I used chef-solo and called chef-solo on my computer with capistrano, it just call the command sudo chef-solo -c /var/chef-repo/shared/solo.rb -j /var/chef-repo/current/nodes/sheldon-venet-0.json -E production >> /var/chef-repo/shared/log/chef-solo.log &

For the nginx cookbook, I just used the default recipe.

But there's something wrong on the server I converged, and I paste the log in /var/chef/cache/chef-stacktrace.out here: https://gist.github.com/tony612/995395eb26e168c06148

This is my solo.rb, hope this helps:

cookbook_path [
               "/var/chef-repo/current/cookbooks",
               "/var/chef-repo/current/site-cookbooks"
              ]
data_bag_path "/var/chef-repo/current/data_bags"
environment "_default"
environment_path "/var/chef-repo/current/environments"
log_level  :auto
log_location STDOUT # "/var/chef-repo/shared/log/chef-solo.log"
role_path "/var/chef-repo/current/roles"
solo false

However, when I run chef-solo on that server directly, it works.

In addition, I didn't overcome this kind of problem for nodes without nginx, so I guess maybe it relates to nginx cookbook.

Versioning doesn't work with install from source unless default

[ version woes ]

If you don't use the default version, then there is a race condition where the cookbook sets all other attributes based on the default version, not the user specified version. To fix, can either delete /opt/nginx* and run chef again, or set attributes again manually.

Nginx Reload Fails /w Incorrect PID Setting on Ubuntu 14.04

I have not tested this out on any other distribution so it may be exclusive to Ubuntu Trusty.

Ubuntu's nginx package uses /run/nginx.pid by default rather than /var/run/nginx.pid. Given that /run is symlinked to /var/run you'd think this isn't a problem, however if you use this cookbook to generate a config file with default['nginx']['pid'] = '/var/run/nginx.pid', then when nginx attempts to reload the config, it will end up deleting the pid file entirely, perhaps thinking it is moving it to a new location when it actually isn't.

As a result, the pid file is destroyed and nginx will fail at any future reload, restart, stop, start commands until you sudo killall nginx.

It took a while to track this one down... not sure how best to handle it. Really, it seems to be an nginx bug in the way it handles reloading its config, but perhaps a fix would be to detect problematic distributions and set default['nginx']['pid'] = '/run/nginx.pid' for them specifically.

recipe[nginx::source] passenger compile error.

Hi, I want to install rbenv+nginx+passenger in vagrant.
My node.json:

{
  "run_list": [         
    "recipe[rbenv]",
    "recipe[rbenv::ruby_build]",
    "recipe[install_rbenv_ruby]",
    "recipe[postgresql::server]",
    "recipe[nginx::source]"
  ],
  "rbenv": {
    "group_users": [ "vagrant" ]
  },
  "nginx": {
    "version": "1.4.7",
    "passenger": {
        "version": "4.0.52",
        "gem_binary": "/opt/rbenv/versions/2.1.2/bin/gem",      
      "root": "/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.52",
      "ruby": "/opt/rbenv/versions/2.1.2/bin/ruby"
    },
    "source": {
      "modules": [
        "nginx::http_stub_status_module",
        "nginx::http_ssl_module",
        "nginx::http_gzip_static_module",
        "nginx::passenger"
      ]
    }
  }
}

When i cook, i got error below:

checking for getaddrinfo() ... found
configuring additional modules
adding module in /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.52/ext/nginx
*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***
*** Running 'rake nginx CACHING=false' in /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.52/ext/nginx... ***
STDERR: /opt/chef/embedded/bin/rake:9:in `require': no such file to load -- rubygems (LoadError)
    from /opt/chef/embedded/bin/rake:9
---- End output of "bash"  "/tmp/chef-script20141001-14979-2i0uo6" ----

It seems /opt/chef/embedded/bin/rake make this error.

Maybe these below can fix this problem?

  1. add setting of the rake's path
  2. add setting of complie as special user

recipe[nginx::source] headers_more_module compile error.

Hi, I want to build nginx from source with the headers_more_module.

  "nginx": {
    "version": "1.4.4"
    "repo_source": "nginx",
    "default_site_enabled": false,
    "install_method": "source",
    "source": {
      "modules": [
        "nginx::headers_more__module"
      ]
    }
  }

But, build fails.
Cause of failure is a tarball been changed to "openresty-headers-more-nginx-module-*".

Please, modify recipe of nginx::headers-more-module.rb.

bash 'extract_headers_more' do
  cwd  ::File.dirname(tar_location)
  user 'root'
  code <<-EOH
    tar -zxf #{tar_location} -C #{module_location}
    mv -f #{module_location}/*/* #{module_location}
  EOH
  not_if { ::File.exists?("#{module_location}/config") }
end

from scatch

using chef/ubuntu-14.04

issue

when you just do

chef.run_list = [
  "recipe[nginx::default]"
]

which is like sudo apt-get install nginx

it spins up nginx on localhost:80

but the nginx.pid is never created
you can find the pid using
ps aux | grep nginx

which in turns leading to
sudo service nginx status
displaying its as not running

or any sudo service nginx cmd
as not working as port 80 is already binded

no default file is made for
/var/www/nginx-default/index.html

more of a annoyance then anything else as i was just trying to get my head around chef and nginx

Add support for defining `ssl_protocols` to mitigate POODLE

In order to mitigate the SSLv3 "POODLE" attack, it should be possible to define attributes for ssl_protocols in the cookbook.

Possibly like this (inspired by @jtimberman):

# this is a default attribute in your cookbook's attributes/default.rb
node.override['nginx']['ssl_protocols'] = 'TLSv1 TLSv1.1 TLSv1.2'

# Or, make it an array, then you can .join it...
node.override['nginx']['ssl_protocols'] = ['TLSv1', 'TLSv1.1', 'TLSv1.2']

Nginx will not install without the 'which' package on Fedora 20

The following error happens on Fedora 20 without the which package installed.

================================================================================
Error executing action `install` on resource 'package[nginx]'
================================================================================


Errno::ENOENT
-------------
No such file or directory - which nginx


Resource Declaration:
---------------------
# In /var/chef/cookbooks/nginx/recipes/package.rb

40: package node['nginx']['package_name'] do
41:   options package_install_opts
42:   notifies :reload, 'ohai[reload_nginx]', :immediately
43:   not_if 'which nginx'
44: end
45:



Compiled Resource:
------------------
# Declared in /var/chef/cookbooks/nginx/recipes/package.rb:40:in `from_file'

package("nginx") do
action :install
retries 0
retry_delay 2
package_name "nginx"
cookbook_name :nginx
recipe_name "package"
not_if "which nginx"
end

Cookbook http_stub_status_module not found

I am trying to write a cookbook to install my rails application and I get the following error when I run vagrant provision

==> default: [2015-01-18T15:24:03+00:00] INFO: Forking chef instance to converge...
==> default: [2015-01-18T15:24:03+00:00] INFO: *** Chef 12.0.3 ***
==> default: [2015-01-18T15:24:03+00:00] INFO: Chef-client pid: 13888
==> default: [2015-01-18T15:24:09+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[build-essential]", "recipe[rvm::vagrant]", "recipe[rvm::system]", "recipe[rvm::gem_package]", "recipe[nginx::source]"] from CLI options
==> default: [2015-01-18T15:24:09+00:00] INFO: Run List is [recipe[apt], recipe[build-essential], recipe[rvm::vagrant], recipe[rvm::system], recipe[rvm::gem_package], recipe[nginx::source]]
==> default: [2015-01-18T15:24:09+00:00] INFO: Run List expands to [apt, build-essential, rvm::vagrant, rvm::system, rvm::gem_package, nginx::source]
==> default: [2015-01-18T15:24:09+00:00] INFO: Starting Chef Run for nginx-berkshelf
==> default: [2015-01-18T15:24:09+00:00] INFO: Running start handlers
==> default: [2015-01-18T15:24:09+00:00] INFO: Start handlers complete.
==> default: /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/rvm/libraries/rvm_chef_user_environment.rb:49: warning: class variable access from toplevel
==> default: [2015-01-18T15:24:11+00:00] INFO: execute[Guard resource] ran successfully
==> default: [2015-01-18T15:24:11+00:00] WARN: Cloning resource attributes for group[rvm] from prior resource (CHEF-3694)
==> default: [2015-01-18T15:24:11+00:00] WARN: Previous group[rvm]: /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/rvm/recipes/vagrant.rb:34:in `from_file'
==> default: [2015-01-18T15:24:11+00:00] WARN: Current  group[rvm]: /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/rvm/recipes/system.rb:33:in `from_file'
==> default: [2015-01-18T15:24:11+00:00] INFO: gem_package resource has been patched to use provider Chef::Provider::Package::RVMRubygems and will install gems to the ruby-1.9.3-p429 RVM Ruby.
==> default: [2015-01-18T15:24:11+00:00] INFO: ohai plugins will be at: /etc/chef/ohai_plugins
==> default: [2015-01-18T15:24:12+00:00] INFO: ohai[custom_plugins] reloaded
==> default: [2015-01-18T15:24:12+00:00] WARN: MissingCookbookDependency:
==> default: Recipe `http_stub_status_module` is not in the run_list, and cookbook 'http_stub_status_module'
==> default: is not a dependency of any cookbook in the run_list.  To load this recipe,
==> default: first add a dependency on cookbook 'http_stub_status_module' in the cookbook you're
==> default: including it from in that cookbook's metadata.
==> default:
==> default: ================================================================================
==> default: Recipe Compile Error in /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/nginx/recipes/source.rb
==> default: ================================================================================
==> default:
==> default:
==> default: Chef::Exceptions::CookbookNotFound
==> default: ----------------------------------
==> default: Cookbook http_stub_status_module not found. If you're loading http_stub_status_module from another cookbook, make sure you configure the dependency in your metadata
==> default:
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default:   /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/nginx/recipes/source.rb:91:in `block in from_file'
==> default:
==> default:   /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/nginx/recipes/source.rb:90:in `each'
==> default:
==> default:   /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/nginx/recipes/source.rb:90:in `from_file'
==> default:
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef/cd3bbd54c0efcf612e706f9728d04ed6/cookbooks/nginx/recipes/source.rb:
==> default:
==> default:  84:    code <<-EOH
==> default:  85:      tar zxf #{::File.basename(src_filepath)} -C #{::File.dirname(src_filepath)}
==> default:  86:    EOH
==> default:  87:    not_if { ::File.directory?("#{Chef::Config['file_cache_path'] || '/tmp'}/nginx-#{node['nginx']['source']['version']}") }
==> default:  88:  end
==> default:  89:
==> default:  90:  node['nginx']['source']['modules'].each do |ngx_module|
==> default:  91>>   include_recipe ngx_module
==> default:  92:  end
==> default:  93:
==> default:  94:  configure_flags       = node.run_state['nginx_configure_flags']
==> default:  95:  nginx_force_recompile = node.run_state['nginx_force_recompile']
==> default:  96:
==> default:  97:  bash 'compile_nginx_source' do
==> default:  98:    cwd  ::File.dirname(src_filepath)
==> default:  99:    code <<-EOH
==> default: 100:      cd nginx-#{node['nginx']['source']['version']} &&
==> default:
==> default: [2015-01-18T15:24:12+00:00] ERROR: Running exception handlers
==> default: [2015-01-18T15:24:12+00:00] ERROR: Exception handlers complete
==> default: [2015-01-18T15:24:12+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-01-18T15:24:12+00:00] ERROR: Cookbook http_stub_status_module not found. If you're loading http_stub_status_module from another cookbook, make sure you configure the dependency in your metadata
==> default: [2015-01-18T15:24:12+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

FATAL: Cookbook file recipes/self_signed_cert.rb has a ruby syntax error:

Getting this error when I try to upload the nginx cookbook

FATAL: Cookbook file recipes/self_signed_cert.rb has a ruby syntax error:
FATAL: .chef/../cookbooks/nginx/recipes/self_signed_cert.rb:44: syntax error, unexpected '{', expecting ')'
FATAL: ...][:ssl][:self_signed][:key]}" {|f|
FATAL: ... ^
FATAL: .chef/../cookbooks/nginx/recipes/self_signed_cert.rb:45: syntax error, unexpected tIDENTIFIER, expecting keyword_end
FATAL: f.write k.to_pem # write private key t...
FATAL: ^
FATAL: .chef/../cookbooks/nginx/recipes/self_signed_cert.rb:46: syntax error, unexpected '}', expecting keyword_end
FATAL: .chef/../cookbooks/nginx/recipes/self_signed_cert.rb:58: syntax error, unexpected $end, expecting keyword_end

Enable Geoip Org DB

Hi All,

I'm just getting to grips with the nginx geoip module and i've come across the $geoip_org parameter which requires an organisation DB to be downloaded. I wanted to to create this issue as a feature request and hopefully start the discussion around it, and if it's straightforward enough I might try tackling it myself.

Cheers!

Can't upgrade version

I'm setting:

# cookbooks/mine/attributes/default.rb
default['nginx']['version'] = "1.6.1"
# cookbooks/mine/recipes/nginx.rb
include_recipe 'nginx::source'

But it only installs the one is defined in the nginx cookbook: 1.4.4
If I change manually the version in the nginx cookbook it works, but this implies editing the source.

Also I set the checksum but nothing.

Checksum vs PGP keys.

Earlier today I ran a recipe I've been writing and I got a weird mismatching checksum error occurring.

So, as recommended by source.rb recipe, I double checked that I specified the checksum in my custom attributes, as well as the version for which I'd like to download - which I had done.

Strangely, this recipe was working fine yesterday and I didn't change anything.

The error message I get from chef goes something like this:

================================================================================
    Error executing action `create` on resource 'remote_file[http://nginx.org/download/nginx-1.6.2.tar.gz]'
    ================================================================================

    Chef::Exceptions::ChecksumMismatch
    ----------------------------------
    Checksum on resource (943ad7) does not match checksum on content (b5608c)

    Resource Declaration:

       ---------------------
           # In /tmp/kitchen/cookbooks/nginx/recipes/source.rb

            58: remote_file nginx_url do

        59:   source   nginx_url
            60:   checksum node['nginx']['source']['checksum']
            61:   path     src_filepath
            62:   backup   false
            63: end
            64:

           Compiled Resource:

       ------------------
# Declared in /tmp/kitchen/cookbooks/nginx/recipes/source.rb:58:in `from_file'

    remote_file("http://nginx.org/download/nginx-1.6.2.tar.gz") do

  provider Chef::Provider::RemoteFile
      action "create"
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             path "/tmp/kitchen/cache/nginx-1.6.2.tar.gz"

             atomic_update true
             source ["http://nginx.org/download/nginx-1.6.2.tar.gz"]
             use_etag true
             use_last_modified true
             cookbook_name :nginx
             recipe_name "source"
             checksum "943ad757a1c3e8b3df2d5c4ddacc508861922e36fa10ea6f8e3a348fc9abfc1a"
           end


       [2014-12-05T19:52:12+00:00] INFO: Running queued delayed notifications before re-raising exception

So, I started doing a little research and trying to find the appropriate checksum for 1.6.2, I headed over to nginx.org and could not find one. So, not sure what do from here? I see that on nginx.org they list PGP keys for each release. Not sure how I could use these to verify the download.

Any ideas? Thanks in advance.

Nginx reload fails silently when bad config is present

Nginx reload blindly sends HUP to running nginx and calls it a success if the signal was sent. Upon receiving the signal, nginx performs a sanity check on it's config, and aborts the reload if it fails. In this case, we will have 'successfully' reloaded nginx, but nginx is still running the old config.

The problem becomes worse if you were to ever explicitly stop nginx, as it will fail to start back.

I have fixed this in our own repo by specifying sanity check && /etc/init.d/nginx reload as the reload_command for the service definition. I would gladly send a PR to do something along those lines for you as well, though there are many paths to init here (runit, upstart, bluepill....) and don't have time to test far beyond what we have running in our own infra.

I can work on a fix for the runit init path if you like, but certainly the rest will need to be addressed as well.

'enable' fails on OSX

I know OS X is not an officially supported platform, but we have had some success in the past. However, with 2.7.4 on OS X 10.9.4, we get the following error:

Recipe: nginx::package
  * package[nginx] action install (skipped due to not_if)
  * service[nginx] action enable
    * Could not find service's label in plist file ''!
================================================================================
Error executing action `enable` on resource 'service[nginx]'
================================================================================

http://pastebin.com/jCYHVFsx

issues since last chef-nginx publish to supermarket

  • after initial run we could not /etc/init.d/nginx reload (it would say reloading fail) ; it required a hard kill nginx (stop, start , restart did not work)
  • also we wrote config files without the '.conf' extension , those are not anymore included in the nginx config

just for the record

Factor out service definition from package/source recipes

It's complicated to define what service[nginx] does per platform, and how it gets created, invoked on any given combination of attributes or used recipes.

It's also defined in more than one place, which triggers resource cloning - lots of ugly WARN messages, as well as potential for bad behavior.

Moving the service declaration to it's own recipe where we can manipulate the parameters based on other logic should still make the resource available across all recipes (and external cookbooks) to notify the service as needed.

http_auth_request_module download is not available, use core module instead

The module's maintainer repo is returning 502. Reported by @rayrod2030, in Gitter.

$ curl -I http://mdounin.ru/hg/ngx_http_auth_request_module/archive/ee8ff54f9b66.tar.gz
HTTP/1.1 502 Bad Gateway
Server: nginx/1.7.4
Date: Sun, 07 Sep 2014 12:35:01 GMT
Content-Type: text/html
Content-Length: 172
Connection: keep-alive
$ curl -I http://mdounin.ru/hg/
HTTP/1.1 502 Bad Gateway
Server: nginx/1.7.4
Date: Sun, 07 Sep 2014 12:36:45 GMT
Content-Type: text/html
Content-Length: 172
Connection: keep-alive

This URL was introduced in #138 by @dwradcliffe (See COOK-3521 for details).

It appears that since Nginx 1.5.4, this module is now included in the core.

Changes with nginx 1.5.4 27 Aug 2013
...
*) Feature: the ngx_http_auth_request_module.

(changelog snippet from here)

The module looks to be in active development, based on the original author's module, so we should probably prefer that one.

build nginx support files after installing passenger

passenger needs to build some support files and it can be done during first passenger initialization but it's impossible(permissions) and should be done manually(by root) If you install nginx and passenger as root and start it as another(non root) user, in my case "deploy" user

following script would help(after installing passenger):

cd `passenger-config --root` && rake nginx

nginx does not start

2.7.5 of the cookbook breaks my deployment. The nginx service fails to start. It doesn't even get far enough to create any message in the error log. There is no error log.

I know you said that 2.7.5 is the last release in the old cookbook format and that it was deprecated, but something changed between 2.7.4 and 2.7.5 that breaks functionality that has worked for a long time.

I would like to ask that breaking changes follow semantic versioning and/or you publish a document explaining how to migrate what worked in 2.7.4 to what will work with later editions of the cookbook.

As of this moment I can lock the version to 2.7.4 and fix my deployment, but I'm not sure what changes I'd need to make to follow your upgrade path. Obviously, I would like to be able to take advantage of future enhancements to the cookbook.

In the interest of full disclosure I am new to chef and cookbook development, so it's entirely possible I'm doing something wrong or ill-advised. If you feel that that is the case I would be happy to discuss that with you.

Thank you for the work you've done on this cookbook, and for your time.

Allow alternative default nginx port

The default port in "default-site.erb" is hardcoded as port 80. This is incompatible with testable configurations of nginx in parallel with default Apache or other standard web services. It also blocks nginx from starting, and fails silently to start nginx if there is such a service active.

I'll be happy to submit a patch to make that virtual host a default 'on' option.

Add support for the phusion passenger PPA

Phusion provides a PPA for installing nginx + passenger. Especially on a slow VPS this is much faster than compiling using the gem, and the package gets updated by doing standard apt-get upgrades.

If that were an option to the passenger recipe it would be a great feature.

vhost support via attributes

From what I could see in the code this is not supported, I wonder however If you would consider adding support for this...

I'm speaking of something like the getchef cookbook witth the "apps" attribute.

Granted that I can jut use templates but It seems like a nice addiction, and sadly I'm not confortable enough with ruby/chef to fork and do it myself :P so I leave the suggestion here

Thanks

Move matchers file to libraries directory

Can you please move the Matchers.rb file for Chefspec into the libraries directory, rather than its current location? That will allow authors that use your cookbook to automatically use your matchers in our own tests.

Kitchen tests fail on Centos 5.1

The current tests only seem to be failing on Centos-5.1 with the following yum cache error:

           ================================================================================
           Error executing action `create` on resource 'yum_repository[epel]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           execute[yum-makecache-epel] (/tmp/kitchen/cache/cookbooks/yum/providers/repository.rb line 53) had an error:
 Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
           ---- Begin output of yum -q makecache --disablerepo=* --enablerepo=epel ----
           STDOUT: 
           STDERR: Traceback (most recent call last):
             File "/usr/bin/yum", line 29, in ?
               yummain.user_main(sys.argv[1:], exit_code=True)

Basically... yum can't update because of a broken certificate.

Nginx::Source running every time

Is there a way to avoid this and not using the default? I have other cookbooks that require ::source but are now triggering everytime.

Compile issues with GeoIP on Ubuntu 14.04

I'm running into libtool versioning issues, the exact error is at the end of make is

libtool: Version mismatch error. This is libtool 2.4.2 Debian-2.4.2-1.7ubuntu1, but the
libtool: definition of this LT_INIT comes from libtool 2.2.6b.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2 Debian-2.4.2-1.7ubuntu1
libtool: and run autoconf again.
make[1]: *** [GeoIP.lo] Error 63
make[1]: Leaving directory `/var/chef/cache/GeoIP-1.4.8/libGeoIP'
make: *** [all-recursive] Error 1

The fix is to run aclocal, automaker and autoconf. The package provides a script for that bootstrap

In this block, we need to call ./boostrap before we call make
https://github.com/miketheman/nginx/blob/d58074b87ca41418bacaa9444579d61b0500cf36/recipes/http_geoip_module.rb#L44-L48

Mention nginx_site in README.mb

Since most people would like to use nginx to serve a webpage or add some kind of custom configuration it would be in place to mention on how to use nginx_site in README

CentOS/RHEL 7 use systemd for process control

Converge fails on enabling/starting the process when using nginx 1.6.1 from EPEL.

[kitchen@4df4899d76f0 ~]$ rpm -ql nginx | grep init
[kitchen@4df4899d76f0 ~]$ rpm -ql nginx | grep service
/usr/lib/systemd/system/nginx.service

One solution may be to factor out the service declaration to it's own recipe and switch on all the platform versions and oddities over there, and accept notifications from other recipes.

Caveat: this still seems to be a blocker for docker (see what I did there?). docker container for cetnos7 uses fakesystemd-1-15.el7.centos.noarch - so systemctl isn't installed, therefore may be unavailable.

Can't setup logformats to be used in nginx.conf

If you want custom logformats for access and error logs, you can't do it via the node['nginx']['access_log_options'] and node['nginx']['error_log_options'] attributes because the conf.d directory isn't included until after the logs are defined in nginx.conf.

I was trying to get all my logs to be in JSON format.

I'm not sure what the right solution is, unless you create a special "formats.d" folder or something that gets included ASAP in nginx.conf.

Fails to install on freebsd with [nginx::source] ---> needs libpcre

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '69'
---- Begin output of pkg rquery '%v' libpcre3 ----
STDOUT: 
STDERR: 
---- End output of pkg rquery '%v' libpcre3 ----
Ran pkg rquery '%v' libpcre3 returned 69

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/nginx/recipes/source.rb

  3: package "libpcre3"
  4: package "libpcre3-dev"

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/nginx/recipes/source.rb:3:in `from_file'

freebsd_package("libpcre3") do
  provider Chef::Provider::Package::Freebsd::Pkgng
  action :install
  retries 0
  retry_delay 2
  guard_interpreter :default
  package_name "libpcre3"
  timeout 900
  created_as_type :package
  cookbook_name "nginx"
  recipe_name "source"
end

NOTE: in freebsd the package name is "pcre"

% pkg rquery '%v %n' pcre
% 8.35 pcre

Use ":delayed" for all service restarts that are not ":immediately"

The standard "restart" option occurs immediately, before all configuration files are necessarily deployed. This means that if a config file being removed or disabled conflicts with a new file, and is presented in the wrong order, the restart will fail until it is manually cleared.

It's very easy to fix by using ":delayed" in all relevant restart options. The fix is in pull request 327.

Log dir should be 750 not 755

You shouldn't be exposing your logs to non-prived users on the system. 750 is what ships with the nginx package.

  • directory[/var/log/nginx] action create
    • change mode from '0750' to '0755'

Upgrading nginx package is not possible

I need to upgrade the currently used nginx packages to a more recent (mainline) version.
Unfortunately, just incrementing the node['nginx']['version'] and changing the node['nginx']['upstream_repository'] won't work, as there's a not_if 'which nginx' clause in the nginx::package recipe, and no posibility to change the package action to upgrade.

I can of course pruge the package in my wrapper cookbook and then reinstall, but this is not very suitable for production, imho.

I'd vote for an attribute like node['nginx']['package']['action'] which defaults to install, but can be overriden, and I'm wondering why the not_if clause is needed?

I'd volunteer implementing this option after we found a nice way of doing it and file a pull request.

Help to maintain the cookbook

Hi @miketheman,
This cookbook seems to be actively used, well done for all this work!
It seems there are a lot of PR waiting though, people look eager to contribute but it seems a bit hard to maintain all of that. I was wondering if you were looking for people to help you to maintain the cookbook ( I might and I'm sure a lot of other people would).

There are 53 PR waiting, and I'm pretty sure it discourages people to contribute further, and it's frustrating to have to implement those workaround when there is already a PR to fix it.

If other people would like to contribute/help or see those PR merge, please say so ๐Ÿ˜„ !

/cc people from the PR @gkra @jeffbyrnes @whatcould @vpryimak @prem-prakash @scarpellini @jcoleman @adepue @brauliobo @JonasNielsen @mhaligan @n1koo @JamesBelchamber @sewer2 @mhenrixon @thommay @eherot @michiels etc...

Thank you!

Delete nginx config

Hi,

I'm probably just not looking in the correct place, but I can't seem to find a way to remove an site from sites-enabled/site-available once it is created.

I tried the following:

    nginx_site "myapp.conf", enable: false

and

    nginx_site "myapp.conf" do
      action [:disable, :delete]
    end

Is this an unsupported feature? Or am I missing something?

Regards,

nginx install fails after subsequent provisions

Forgive me if I am doing something stupid, I'm in the middle of figuring out chef...

I've got nginx installed once already, modified my attributes (for a different recipe, not nginx), and nginx fails due to some files that have been modified that I haven't touched myself. I would assume apt-get would overrite the files, but that doesn't seem to be happening:

Setting up libperconaserverclient18.1-dev (5.6.20-68.0-656.precise) ...
STDERR: Configuration file `/etc/nginx/win-utf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** win-utf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing nginx-common (--configure):
 EOF on stdin at conffile prompt
dpkg: dependency problems prevent configuration of nginx-full:
 nginx-full depends on nginx-common (= 1.1.19-1ubuntu0.6); however:
  Package nginx-common is not configured yet.
dpkg: error processing nginx-full (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-full | nginx-light; however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
dpkg: error processing nginx (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 nginx-common
 nginx-full
 nginx

This is ubuntu 14.04

socketproxy recipe fails on access_log "main" directive

When I try to deploy socketproxy without default site enabled, nginx is failing with the following error:

ubuntu@application:~$ sudo /etc/init.d/nginx start
Starting nginx: nginx: [emerg] unknown log format "main" in /etc/nginx/sites-enabled/socketproxy.conf:8
nginx: configuration file /etc/nginx/nginx.conf test failed

My configuration snippet is:
:nginx => {
:socketproxy => {
:root => '/',
:default_app => 'storage',
:apps => {
:storage => {
:socket => {
:type => 'tcp',
:port => 3000
}
}
}
},
:default_site_enabled => false,
:port => 80

And I'm adding these recipes in the role:
"recipe[nginx]",
"recipe[nginx::socketproxy]"

Opsworks NoMethodError

I can't manage to make this cookbook works. I'm using opsworks and have tried on different ec2 instances. (Ubuntu 12.04 and 14.04).
This is the error I get:

Recipe Compile Error in /var/lib/aws/opsworks/cache.stage2/cookbooks/nginx/recipes/default.rb 

NoMethodError
-------------
undefined method `[]' for nil:NilClass


Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/nginx/recipes/ohai_plugin.rb:27:in `from_file'
/var/lib/aws/opsworks/cache.stage2/cookbooks/nginx/recipes/package.rb:21:in `from_file'
/var/lib/aws/opsworks/cache.stage2/cookbooks/nginx/recipes/default.rb:22:in `from_file'


Relevant File Content:
----------------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/nginx/recipes/ohai_plugin.rb:

20:  #
21:  
22:  ohai 'reload_nginx' do
23:    plugin 'nginx'
24:    action :nothing
25:  end
26:  
27>> template "#{node['ohai']['plugin_path']}/nginx.rb" do
28:    source 'plugins/nginx.rb.erb'
29:    owner  'root'
30:    group  node['root_group']
31:    mode   '0755'
32:    notifies :reload, 'ohai[reload_nginx]', :immediately
33:  end
34:  
35:  include_recipe 'ohai::default'
36:  


[2014-08-25T18:51:24+00:00] ERROR: Running exception handlers
[2014-08-25T18:51:24+00:00] ERROR: Exception handlers complete
[2014-08-25T18:51:24+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2014-08-25T18:51:24+00:00] ERROR: undefined method `[]' for nil:NilClass
[2014-08-25T18:51:24+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

If I manually set node['ohai']['plugin_path'] to /etc/chef/ohai_plugins, I get an error saying Cookbook ohai not found..

I'm not using any custom cookbook and have left all the attributes to their default value.
I'm just using Berkshelf with this in my Berksfile and then call nginx::default

source 'https://api.berkshelf.com'
cookbook 'nginx'

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.