![]() ![]() We can create a default homepage by using the touch command to create an empty file named index.html in the /var/Let’s put in a message To exit nano, press the key combination Ctrl+X. Further configuration is required.Īs you may have guessed by the contents of the file it contains our previously seen nginx landing page. If you see this page, the nginx web server is successfully installed and working. We can open this file to view its contents with the default Ubuntu test editor nano like in the following example: sudo nano /var/įont-family: Tahoma, Verdana, Arial, sans-serif ![]() Nginx serves its content from the /var/We see a file named As previously we can start it with systemctl start nginx command or restart the system and the service will start automatically upon system boot. To enable our nginx service upon system boot, we use systemctl enable nginx command accordingly:Īs you may note, the service is enabled but not started. As expected, our service hasn’t started automatically. If we wish to disable the service entirely so that it won’t be started upon system boot, we should use systemctl disable nginx command like this:Īs you can see, we have disabled the nginx service, rebooted the machine and reconnected to it. If we wish to apply some configuration changes, we can reload the service without dropping any current connections by using systemctl reload nginx command.Īs you can see in the picture, our service has not been disrupted after reloading it. This basically stops and starts the service again, but with a single command.Īs we see the service was restarted 5 seconds ago. If something goes wrong, we can always restart our service with systemctl restart nginx command. The nginx service becomes active and our landing page is accessible once again. If we want to start the service again without waiting for a reboot, we use systemclt start nginx: Our website will not load until system reboot. Should we want to stop nginx service until the next system reboot, we will use systemclt stop nginx command:īy using systemctl status nginx command we can see the service status which is now stopped. We can see our nginx service being active and running. Let’s view the status of our nginx service by typing systemclt status nginx as follows: For this we will use the Linux systemctl (stands for systemd control) to manage our nginx service. We may need to view the status, reload, disable, enable, restart, start or stop the service to make and apply changes or perform maintenance. In practice we will need to manage our NGINX system service. You should see a default NGINX landing page as displayed above if port 80 is open and NGINX is running. To allow non-encrypted incoming web traffic, we need to open the HTTP port 80 through the default Ubuntu firewall ufw: sudo ufw allow 80Īfter this we can check if the web server is reachable by typing our server’s IP address into the browsers address bar: You may double check its status: sudo ufw status ![]() We suppose ufw is enabled on your Ubuntu 20.04 system. We will not be able to access our nginx web server by typing its IP address in a web browser until it is whitelisted in the firewall settings. This takes care of the installation part. When prompted we press Y to agree to the installation and wait until nginx is installed. ![]() Next, we install Nginx web server and its dependencies: sudo apt install nginx In this guide we will be using user web that has sudo rights on the system.īefore installing any software it’s a good idea to update your apt (short for Ubuntu’s default package manager aptitude) software list: sudo apt update Log-in to your server through VNC, SSH or KVM virtual management console as a root user with sudo privileges. To install and configure Nginx on Ubuntu 20.04 server, follow these 7 steps: #Step 1: Install NGINX on Ubuntu 20.04įirst and foremost, we need to access our host machine on which we will be configuring our NGINX service. #7 Steps to Install Nginx on Ubuntu 20.04 The main goal of the NGINX project is to ensure a stable, lightweight, and highly efficient web server for websites that experience a huge amount of traffic. NGINX is one of the most popular web servers in the world that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. This step-by-step tutorial demonstrates how to install Nginx on Ubuntu 20.04 with instructions on how to configure it, including how to manage the NGINX system service and configure Nginx server blocks to host multiple websites. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |