-
-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx 0.6.0: bad location block causes nginx restart to fail #1029
Comments
After some more testing, it looks like defining the location blocks using an example similar to the README causes problems. From the README: nginx::nginx_servers:
'www.puppetlabs.com':
www_root: '/var/www/www.puppetlabs.com'
'rack.puppetlabs.com':
proxy: 'http://puppet_rack_app'
nginx::nginx_locations:
'static':
location: '~ "^/static/[0-9a-fA-F]{8}\/(.*)$"'
server: www.puppetlabs.com
www_root: /var/www/html
'userContent':
location: /userContent
server: www.puppetlabs.com
www_root: /var/www/html If I setup this type of block in Puppet, it is always creating the If I move the Is using Is this due to changes that haven't been updated in the documentation? |
Yes, i have exactly the same problem. |
As an update to this ticket for anyone reading, here is an example of defining a Server and Location using Hiera data. This is used for a nginx proxy for a local Conflunce server 6 install. The first entry "_" is the default server on port 80 with a straight redirect to SSL port 443 The important part is specifying nginx::nginx_servers:
'_':
ensure: 'present'
listen_options: 'default_server'
listen_port: 80
ssl: false
ssl_redirect: true
use_default_location: false
'confluence':
ensure: 'present'
index_files: ~
listen_options: 'default_server'
listen_port: 443
locations:
'confluence':
ensure: 'present'
location: '/'
proxy_set_header:
- 'X-Forwarded-Host $host'
- 'X-Forwarded-Server $host'
- 'X-Forwarded-For $proxy_add_x_forwarded_for'
proxy: 'http://localhost:8090/'
'synchrony-proxy':
ensure: 'present'
location: '/synchrony-proxy'
proxy: 'http://localhost:8090/synchrony-proxy'
proxy_http_version: '1.1'
proxy_set_header:
- 'X-Forwarded-Host $host'
- 'X-Forwarded-Server $host'
- 'X-Forwarded-For $proxy_add_x_forwarded_for'
- 'Upgrade $http_upgrade'
- 'Connection "Upgrade"'
server_name:
- 'wiki.example.com'
- 'wiki'
ssl: true
ssl_cert: '/etc/pki/tls/certs/cert_file'
ssl_key: '/etc/pki/tls/private/cert_key'
ssl_port: 443
use_default_location: false |
I think this happens because in |
Related to this issue: Their is no test coverage of nginx::nginx_servers::locations |
@ardrigh |
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
Trying to create a default entry to redirect HTTP to HTTPS
What are you seeing
Nginx service fails to restart due to
location
block outside theserver
block in the generated file:What behaviour did you expect instead
A
location
block inside theserver
block, or a better solution would be no location block for this redirect.Output log
Any additional information you'd like to impart
Adding
use_default_location: false
withssl_redirect: true
will remove the location block.This should not be required with
ssl_redirect: true
The text was updated successfully, but these errors were encountered: