# # #介绍 Nginx is one of the most popular web servers in the world and is responsible for hosting some of the most traffic on the web. In most cases, Nginx is more resource-friendly than Apache and can be used as a network server or as a reverse proxy server.
In this tutorial, we will discuss how to install Nginx on an Ubuntu 14.04 server.
# # #预备工作 Before starting this tutorial, you should have a normal non-root user on your server and have the ' sudo ' permission configured. Also available in our [Ubuntu 14.04 Initial Server Setup Guide] (https://www.digitalocean.com/community/articles/ initial-server-setup-with-ubuntu-14-04) Learn how to configure a regular user account.
When the available accounts are ready, log in with the non-root user.
# # #步骤1-Install Nginx We can easily install Nginx because the Ubuntu team provides an Nginx package in the default library.
Because this is the first interaction with the APT package system in this session, we should update the local package index before we start, so that we are using the latest information. Then, install Nginx:
sudo apt-get updatesudo apt-get install nginx
You may see the user Password prompt, enter to confirm that you want to complete the installation, there will be appropriate software to download to your server, and automatically install.
# # #步骤2-Check the network server
Ubuntu 14.04 By default, Nginx will start automatically when the installation is complete.
You can access the default Nginx landing page to confirm that the software is running properly by accessing your server domain name or browser public IP.
If you don't create a domain name for your server, you can see how to create a domain name with Digitalocean.
If there is no alternate domain name or no need, you can use the server's public IP address, do not know the public IP, can be obtained from the command line in a variety of ways.
At your server command prompt, enter the following:
ip addr show eth0 | grep inet | awk ‘{ print $2; }‘ | sed ‘s/\/.*$//‘
Get one or two lines of content and try each line in the browser to see if it works.
Another way is to enter this line of content, which should be returned to your public IP, as seen from another address on the Web:
curl http://icanhazip.com
After you get your server IP or domain name, enter the address bar of your browser: "' Http://server_domain_name_or_IP '
You will see the default Nginx landing page, which should look like this:
This is the default page, where Nginx prompts the server to install correctly.
# # #步骤3-Manage Nginx processes
Now that your Web server is up and running, let's look at some basic administrative commands.
To stop a network server, you can enter:
sudo service nginx stop
Start the Web server and enter: "sudo service nginx start"
Stop, and then start the server again, type: ' sudo service nginx restart '
Enter the following to confirm that the network server restarts automatically after the server restarts: "sudo update-rc.d nginx defaults"
These should be achievable by default, so you might see the following message: "System start/stop links For/etc/init.d/nginx already exist. ```
This just tells you that it has been configured correctly and no additional settings are required. In summary, either way, the Nginx server is now configured to start at boot time.
# # #结束语
Now that you have a Web server installed, you can have a lot of options for the different types of services and the technologies you want to use to get a richer experience.
Click Learn how to use the Nginx server module. If you want to create a more complete application stack, you can check out this article: How to configure a lemp stack on Ubuntu.
by Justin Ellingwood
From:https://www.digitalocean.com/community/articles/how-to-install-nginx-on-ubuntu-14-04-lts
Installing Nginx in Ubuntu 14.04