![]() ![]() The multi_accept directive should be uncommented and set to on. ![]() However, the number of connections doesn’t directly equate to the number of users that can be handled by the server, as the majority of web browsers open at least two connections per request. Therefore, if you have two CPU cores and an open file limit of 1024, your server can handle 2048 connections per second. ![]() This tells Nginx how many simultaneous connections can be opened by each worker_process. The events block contains two directives, the first worker_connections should be set to your server’s open file limit. The general rule of thumb is to set this to the number of CPU cores your server has available. The worker_processes directive determines how many workers to spawn per server. This will make managing file permissions much easier in the future, but this is only acceptable security-wise when running a single user access server. Start by setting the user to the username that you’re currently logged in with. If you would find it easier to see the whole thing at once, feel free to download the complete Nginx config kit now. I’m not going to list every configuration directive but I am going to briefly mention those that you should change. Include /etc/nginx/modules-enabled/*.conf Next, open the Nginx configuration file, which can be found at /etc/nginx/nf: sudo nano /etc/nginx/nf ![]() Run the following to get your server’s open file limit and take note, we’ll need it as well: ulimit -n Take note of the number as we’ll use it in a minute: grep processor /proc/cpuinfo | wc -l However, before opening the configuration file, you need to determine your server’s CPU core count and the open file limit.Įnter the following command to get the number of CPU cores your server has available. Out-of-the-box Nginx is pretty well optimized, but there are a few basic adjustments to make. Now that Nginx has successfully been installed it’s time to perform some basic configuration. Once complete, you can confirm that Nginx has been installed with the following command: nginx nginx -vĪdditionally, when visiting the Fully Qualified Domain Name (FQDN) pointing to your server’s IP address in the browser, you should see an Nginx welcome page. Then install Nginx: sudo apt install nginx -y There may now be some packages that can be upgraded, let’s do that now: sudo apt dist-upgrade -y Instead, I like to use the package repository maintained by Ondřej Surý that includes the latest Nginx stable packages.įirst, add the repository and update the package lists: sudo add-apt-repository ppa:ondrej/nginx -y Although the official Ubuntu package repository includes Nginx packages, they’re often very outdated. Nginx has become the most popular web server software used on Linux servers, so it makes sense to use it rather than Apache. Last login: Fri May 14 08:25:27 2021 from Nginx * Pure upstream Kubernetes 1.21, smallest, simplest cluster ops! Usage of /: 44.2% of 4.67GB Users logged in: 0 System information as of Fri May 14 08:26: In this chapter I will guide you through the process of setting up Nginx, PHP-FPM, and MariaDB-which on Linux is more commonly known as a LEMP stack-that will form the foundations of a working web server.īefore moving on with this tutorial, you will need to open a new SSH connection to the server, if you haven’t already: ssh ssh to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-73-generic x86_64) In chapter 1 of this guide, I took you through the initial steps of setting up and securing a virtual server on DigitalOcean using Ubuntu 20.04. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |