Today I'll be showing you how to install Nginx, pronounced Engine X, on Ubuntu..
But first.. what is Nginx?
Because I want to give you the straight forward explanation of what it is..
"NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability"
To read more about it, please visit their website:
Today I'll be going over how I installed it on my machine!
Before doing anything, I always like to make sure my system is up to date. To do the same, run this command:
Simple install it by running the command below:
Remember, if we want to create a folder in a specific directory, we will need to move to that directory.
While in /var/www, we will create the new folder. Name it whatever you would like, and then, move into that folder, we will need to create a text file in there.
Here is an example of how to do so:
After we move into the new folder we just created. We are going to create the text file.
I prefer to use VIM, but you can honestly use anything you want, like nano.
If you are using VIM, run the command:
sudo vim index.html
Once you've created the file using sudo vim index.html, you're going to need to edit that text file.
You first have to press 'i' to edit. You can copy what I did below as far as html tags, but you can write whatever you want between the tags.
When done, hit 'esc', type ':wq', and hit enter to quit. Now that file should be saved.
To create the virtual host, you will need to move to the correct directory first.
See my example on line 5 in the screenshot:
Once we are in that directory, we will create a new file.
sudo vim (name)
In my example, I also made the name of my file linuxseb, even though I named my folder that. I suggest creating different names for files and folders so it is less confusing, but it is up to you how you want to go about that! :)
See screenshot below, and copy what I have.
Also, don't forget!
Be sure for the server_name line and the root line to replace "linuxwithseb.com" and "linuxseb" with your correct names.
We are just about done. Go ahead and restart the service by running the command:
sudo service nginx restart
Once that has been restarted, go to your browser and type localhost:81
this is what you should get!
If your website is working and it shows up, it means you've successfully installed Nginx :)
Tutorials like this are for beginners and for practice. Please remember to "stop" Nginx if you're not going to use it. This is just for the sake of security.
sudo systemctl stop nginx
sudo systemctl status nginx