Skip to content
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

Delete default site #996

Closed
KZachariassen opened this issue Dec 29, 2016 · 4 comments
Closed

Delete default site #996

KZachariassen opened this issue Dec 29, 2016 · 4 comments
Labels

Comments

@KZachariassen
Copy link

KZachariassen commented Dec 29, 2016

Hi,

Is there a way to delete the default site listing on port 80?

when I run this module on Ubuntu 1604:

  class { 'nginx': }

  nginx::resource::vhost { 'my-website':
    www_root    => '/var/www/my-website/',
  }

The port 80 is still bound to the default nginx site, a quick and dirty fix is to do this

  class { 'nginx': }

  file { 'default-nginx-disable':
    ensure  => absent,
    path    => '/etc/nginx/sites-enabled/default',
    require => Package['nginx'],
    notify  => Service['nginx']
  }

  nginx::resource::vhost { 'my-website':
    www_root    => '/var/www/my-website/',
  }
@wyardley
Copy link
Collaborator

Short answer, you have to set use_default_location=false
see #904 etc.

@y2kbadbug
Copy link

Sorry to bring up an old issue, I just felt it was better than opening a new one. I added use_default_location => false, to my server resource but it just removed the location section of that vhost.

As this issue is stating, I want to get rid of the default vhost created initially located in /etc/nginx/sites-enabled/default.

Is there another place I need to put "use_default_location" outside of the server resource?

I also feel it's worth mentioning that #904 is not related to the question asked.

Thanks!

@evanstachowiak
Copy link

evanstachowiak commented May 9, 2019

@y2kbadbug you can set nginx::server_purge: true in hiera and that will remove all non-puppet managed files in both sites-enabled and sites-available.

This wasn't immediately obvious, I had to do a little digging myself.

@dev-e
Copy link

dev-e commented Aug 20, 2019

This directive in /etc/nginx/nginx.conf enables default nginx site in any way:
include /etc/nginx/conf.d/*.conf;
To remove /etc/nginx/conf.d/default.conf use nginx::confd_purge: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants