The Easiest Method of Installing Nginx on Ubuntu 18.04 for Non-profit Fundraising Software Solutions

We all have heard the wonders of the Nginx web server and how it beats critically acclaimed servers like Apache in terms of speed and performance. The launch of this server has not only empowered web applications but also has helped them move from HTML to dynamic pages.

One of the biggest advantages of Nginx is it is multifunctional. In addition to being a powerful tool for managing servers and web traffic, the same tool can be utilized as a reverse proxy, load balancer, web server, content cache, etc. The constant and consistent improvements and additions also ensure the seamless delivery of web applications. Hence Nginx becomes ideal for non-profit fundraising software solutions and charity donation platforms.

The quick and easy method discussed in this article for installing Nginx on Ubuntu 18.04 is provided by Kalpana Sharma, working as Ruby on Rails developer in GammaStack.

To get started with the installation process, you’ll be needing the following:

  • A system running Ubuntu 18.04
  • A user account with sudo privileges
  • The apt package manager utility, included by default
  • The UFW, or UnComplicated Firewall, included by default
  • SSH Access

Installing Nginx

Log into your server via SSH and update your local software database. Before installing new software, it is recommended to update your local software database. This process ensures that you are installing the latest stable version of the software. Once you are done, install Nginx.

Allow Nginx Traffic Through a Firewall

Before testing Nginx, the firewall software needs to be adjusted to allow access to the service. Nginx registers itself as a service with ufw upon installation, making it straightforward to allow Nginx access.

To generate a list of the firewall rules, use the following command:

You should get a listing of the application profiles:

Nginx full – Opens Port 80 for normal web traffic, and Port 443 for secure encrypted web traffic.

Nginx HTTP – Opens Port 80 for normal web traffic.

Nginx HTTPS – Opens Port 443 for encrypted web traffic.

OpenSSH – This is a configuration for SecureShell operations, which allows you to log into a remote server through a secure, encrypted connection.

To allow normal HTTP traffic to your Nginx server, use the Nginx HTTP profile with the following command:

To check the status of your firewall, type:

You should see HTTP traffic allowed in the displayed output:

Verify and Manage Nginx Process

To check the status of the Nginx service, run the following command:

The system will return a list of information about the Nginx service. The active line indicates whether the service is running or not. If you need to start the service, use the following command:

Now that you have your Nginx service up and running, let’s review some basic management commands.

To stop Nginx service, type:

To stop and then start the service again, type:

To reload configuration changes without dropping connections, type:

By default, Nginx is configured to start automatically when the server boots. If this is not what you want, you can disable this behavior by typing:

To re-enable the service to start up at boot, you can type:

Setup Server Blocks

Nginx uses a configuration file to determine how it behaves. One way to use the configuration file is to define server blocks. We will set up a domain called example.com, but you can always replace this with your own domain name.

By default, the main Nginx configuration file is located at /etc/nginx/nginx.conf. Nginx site-specific configuration files are kept in /etc/nginx/sites-available and symlinked into /etc/nginx/sites-enabled/. Generally, we create a separate original file in the sites-available directory for each domain or subdomain and then set up a symlink in the sites-enabled directory.

Let’s create a separate directory structure within /var/www for our example.com site:

Create and open a basic HTML index file to work as a test webpage:

In the Vi text editor, enter the following or any other text you want to use, save and exit

To create a new server block file for our Test website, type:

This would launch the Vi text editor and create a new server block file.
Enter the following lines into the text file:

This tells Nginx to look at the /var/www/example directory for the files to serve, and to use the index.html file we created as the front page for the website. Save the file and exit.

Next, enable the file by creating a link from it to the sites-enabled directory, which Nginx reads from during startup:

Next, test to make sure that there are no syntax errors in any of your Nginx files:

If there aren’t any problems, restart Nginx to enable your changes:

Testing

In a browser window, visit www.example.com. Nginx should intercept the request, and display the text we entered in the HTML file.
The above solution by Kalpana has helped several non-profit fundraising software users and charity donation platform users in installing Nginx on Ubuntu 18.04 and move to the faster server for flawless delivery of their fundraising web applications.

GammaStack helps non-profit organizations by rendering them comprehensive non-profit fundraising software solutions, charity donation platforms, team fundraising platforms, online donor management software, crowdfunding platform software and custom solution to give their campaigns a strong boost. 

These solutions help non-profits manage their fundraising campaigns effectively and also equip them with tools that help them increase reach, awareness, donor retention, donors and maximize their funds.

Need a non-profit fundraising software for your next small or big campaign? Contact GammaStack today!

About the author:
Kalpana Sharma,
Ruby on Rails developer at GammaStack

Leave a Comment

Required fields are marked *