How to: Install NginX
How to: Install NginX
If you want to Install NginX, we currently host a PPA that tries to keep up with the latest updates from NginX. Sometimes we make changes to the build when something breaks or doesn’t work but most of the time we use the same package that is provided by the NginX team. Below are the instructions on how to install NginX using our PPA or the NginX team´s.
I. Add our Repository
The first step is adding our repository to your Ubuntu install in order to get NginX. Below are the two repositories we maintain and the two repositories the NginX team maintains. Be sure to select / use only one of them.
Mainline Repositories:
sudo add-apt-repository ppa:cloudingenium/nginx-mainline
&
sudo add-apt-repository ppa:nginx/development
Stable Repositories:
sudo add-apt-repository ppa:cloudingenium/nginx-stable
&
sudo add-apt-repository ppa:nginx/stable
We obviously recommend our repositories as the information posted on the site pertains to those, but you may chose the NginX team’s repositories as most of the time we copy theirs into ours (only when we need different behavior do we make changes to the build but usually by the next release they’ve addressed the issues).
After you have added the repository, execute sudo apt-get update to get the latest binaries.
II. Install NginX
Thus far easy right? Well, now it is still easy but you need to decide which package to install. If you read our Custom NginX Distribution post you can find out more about the different packages and what they contain. Sometimes we recommend the basic NginX package, but in other cases you need extra modules found in the Extras package or you want to play with NAXSI to protect your server. The choice is yours! We are going to use the extras packages as we believe is the most complete one and a good place to start.
Simply execute: sudo apt-get install nginx-extras to get it install on your server
III. Configure NginX
Now it is time to configure NginX. This is probably the most tedious part of the installation. If you are not familiar with NginX you are going to need to read on how to properly configure the different sections and where those configuration files are stored. You will also need to decide on a number of options / settings that fine tune the performance and HTTP communication parameters of your new Web Server. Below is a small and quick getting started guide to orient you. This should help you figure out where to start so you can more quickly get up to speed with NginX:
- Open the main configuration file: /etc/nginx/nginx.conf
- Add your sites’ configuraiton files at: /etc/nginx/sites-available
- Make symbolic links to /etc/nginx/sites-enabled for the configuration sites you want to enable (like what Apache does)
- You can use common files and include them through the include directive.
- Files on the /etc/nginx/conf.d are included automatically so you can create different sections for ease of management instead of filling up your main configuration file.
Love
Can we use Let's Encrypt, the free and open certificate authority?
Hola! gracias por la info, me sirvió el comando sacandole el nombre del server. En mi caso, fue una migración…
Yes 3rd option helped me too. I removed the WC key Values from config file then started working.
I know this is from 2014. But really, thank you!