3

As you know when you install nginx, it comes with default pool called www and a default site called default.

How can I safely remove these two? Because I have created a new pool and site and I want to release some resources by deleting these.

3
  • Did you try going to sites-enabled and delete the symlink to default?
    – shinjijai
    Aug 10, 2017 at 20:01
  • Nginx does not have pools. Are you referring to PHP pools? In general with Nginx if you want to remove a site defined in its own file you just delete the file and restart.
    – Tim
    Aug 10, 2017 at 21:08
  • Yeah sorry I am talking about php-fpm pools. Aug 11, 2017 at 13:50

3 Answers 3

4

Your file locations and service names might be a bit different, but you just need to delete the two configs and reload:

  1. Delete the pool configuration file /etc/php/7.0/fpm/pool.d/www.conf
  2. Delete the default site configuration file /etc/nginx/sites-available/default and its symlink /etc/nginx/sites-enabled/default
  3. Reload nginx sudo service nginx reload
  4. Reload fpm sudo service php7.0-fpm reload
1
  • 2
    You can leave the configuration file in sites-available, since it won't be enabled unless it's linked to sites-enabled. Up to you.
    – Zenexer
    Aug 12, 2017 at 9:49
1

You could also leave www.conf as a template for later use:

  1. mv /etc/php/7.0/fpm/pool.d/www.conf /etc/php/7.0/fpm/pool.d/www.conf.template
  2. sudo service php7.0-fpm reload

This way default config is still present and can be used as a template for other pool configurations. The file itself won't be used to create a php pool as it does not meet the include directive in /etc/php/7.0/fpm/php-fpm.conf:

include=/etc/php/7.0/fpm/pool.d/*.conf

0

If you are looking to remove default ngnix file only and not php pool, then you can follow this answer. I am writing this assuming the server as ubuntu. Files location may be a little different for different machines. You just need to remove default server configuration from sites-available and sites-enabled. Follow these instructions :

  1. Go to sites-enabled by sudo cd /etc/nginx/sites-enabled.
  2. Delete the link to default file sudo rm -f default.
  3. Go to sites-available by sudo cd /etc/nginx/sites-available.
  4. Delete the file default by sudo rm -f default.
  5. Reload ngnix to check if everything is alright and make your change to come into effect by sudo nginx -t && nginx -s reload

If it does not show any error, proves entries done by you have been accepted and you have removed the default server file done by ngnix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.