nginx is a free, open source, high-performance web server. Need HTTP and HTTPS but don’t want to run Apache? Then nginx may be your next go-to, at least for Linux.
- These instructions are intended specifically for installing nginx on Ubuntu 14.04 LTS.
- I’ll be working from a Liquid Web Self Managed Ubuntu 14.04 server, and I’ll be logged in as root.
Step #1: Install nginx
First, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.
apt-get -y update
Then it’s a matter of just running one command for installation via apt-get:
apt-get -y install nginx
Step #2: Find Your IP Address; Visit Your Site
Once the installation is complete the nginx service should automatically start and begin listening on port 80.
Find your server’s IP address run the following command:
ip addr show eth0 | grep inet
In this case we are assuming that eth0 is configured with the primary public IP of your server. Your result may look similar to:
inet xxx.xxx.xxx.xxx/22 brd yyy.yyy.yyy.yyy scope global eth0
Where xxx.xxx.xxx.xxx is the IP address of your server.
Verify that nginx is running by visiting http://xxx.xxx.xxx.xxx. For example: http://126.96.36.199.
You should receive a page similar to:
Step #3: Manage the nginx Service
Start the nginx Service:
service nginx start
Stop the nginx Service:
service nginx stop
Restart the nginx Service:
service nginx restart
Check the Status of the nginx Service:
service nginx status
Assure that nginx starts at boot:
update-rc.d nginx defaults
When running the last command you may receive:
System start/stop links for /etc/init.d/nginx already exist.
The above error simply means that nginx is already configured to start when the server boots.
Try a Free Cloud Server.
Trying a new server is a breeze, and it’ll be up and running in only a few minutes...
Tagged with: http • https • LTS • nginx • ubuntu • ubuntu 14.04 • web server