-
-
Notifications
You must be signed in to change notification settings - Fork 872
Closed
Description
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 4.5.3 (Puppet Enterprise 2016.2)
- Ruby: ruby 2.1.9p490
- Distribution: CentOS 7
- Module version: puppet-nginx 0.6.0
How to reproduce (e.g Puppet code you use)
Trying to create a default entry to redirect HTTP to HTTPS
nginx::nginx_servers:
'_':
ensure: 'present'
listen_options: 'default_server'
listen_port: 80
ssl: false
ssl_redirect: true
What are you seeing
Nginx service fails to restart due to location
block outside the server
block in the generated file:
# MANAGED BY PUPPET
server {
listen *:80 default_server;
server_name _;
return 301 https://$host$request_uri;
access_log /var/log/nginx/_.access.log combined;
error_log /var/log/nginx/_.error.log;
}
location / {
index index.html index.htm index.php;
}
What behaviour did you expect instead
A location
block inside the server
block, or a better solution would be no location block for this redirect.
# MANAGED BY PUPPET
server {
listen *:80 default_server;
server_name _;
return 301 https://$host$request_uri;
access_log /var/log/nginx/_.access.log combined;
error_log /var/log/nginx/_.error.log;
}
Output log
Info: /Stage[main]/Nginx/Nginx::Resource::Server[_]/Concat[/etc/nginx/conf.d/_.conf]/File[/etc/nginx/conf.d/_.conf]: Scheduling refresh of Class[Nginx::Service]
Info: Concat[/etc/nginx/conf.d/_.conf]: Scheduling refresh of Class[Nginx::Service]
Info: Nginx::Resource::Location[_-default]: Scheduling refresh of Class[Nginx::Service]
Info: Class[Nginx::Service]: Scheduling refresh of Service[nginx]
Error: /Stage[main]/Nginx::Service/Service[nginx]: Failed to call refresh: Could not restart Service[nginx]: Execution of '/bin/systemctl restart nginx' returned 1: Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
Error: /Stage[main]/Nginx::Service/Service[nginx]: Could not restart Service[nginx]: Execution of '/bin/systemctl restart nginx' returned 1: Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
Any additional information you'd like to impart
Adding use_default_location: false
with ssl_redirect: true
will remove the location block.
This should not be required with ssl_redirect: true
Metadata
Metadata
Assignees
Labels
No labels