Have you heard about Debian? It is one of the oldest and most stable Linux distributions ever for Desktop and servers, it is not widely used as Ubuntu or CentOS, but still a great choice for all those who want to try Linux for the first time or to host their production apps.
The great news is Nginx is fully supported on Debian. That’s why today we will show you how to install Nginx on Debian 8, the latest stable version.
- Debian 8.x installed and working.
- No other web server running (apache, lighttpd, etc).
- Update your system:
sudo apt-get update && sudo apt-get upgrade
How can I install Nginx on Debian 8?
We will use apt-get, the package manager used by Debian to install and remove packages (same as Ubuntu). However, if you want to install Nginx from source you can do it by following this guide: How to install Nginx from source
sudo apt-get install nginx
Add Nginx to start automatically after rebooting your server:
sudo update-rc.d nginx defaults
Try loading your server IP on the browser: http://your.server.ip/
You should see the default Nginx default page for Debian 8, something like this:
Other way to test it, usign Curl from command line:
That should show you the HTML code of the default Nginx page.
How can I manage Nginx on Debian 8?
First, try locating the configuration file and edit as needed:
nano -w /etc/nginx/nginx.conf
If you need help configuring Nginx main configuration file, check out this guide: Nginx Configuration Example
After editing you can restart it and start your server:
sudo service nginx start
If you need to stop it or restart, you can use:
sudo service nginx start sudo service nginx restart
Reloading is better than restarting sometimes: if you have a production server and want to avoid any downtime, after editing Nginx configuration files you can issue a reload command instead of restart:
sudo service nginx reload
This will reload the Nginx configuration files and prevent any HTTP service interruption.
Further reading to learn more about Nginx manipulation commands: 8 Essential Nginx Commands
If you followed this guide at this point you should have your Nginx web server powering your Debian 8 distribution. Remember this guide is a basic guide, it’s up to you to configure and get Nginx working as your apps need.
Please let us know if you have any problems or issues.
Popular search terms:
- how to start nginx debian 6
- How to Install Nginx on Debian
- nginx debian 8
- scale scale nginx install