Tag archive for: location

Understanding the default Nginx virtual host (or server) configuration

After you had installed Nginx, one of the first thing to do is to check whether it is running ok.

One way to do so is to use your browser to send a HTTP request to test it.

If you had installed Nginx on your local machine, then you may enter http://localhost or http://127.0.0.1 into the location bar of your browser.

When you had setup Nginx on a separate machine on your home network, you may also enter http://<ip_address_of_the_machine> in the location bar of your browser. For example, in how to host a WordPress website on a Raspberry Pi with Raspbian Buster Lite and Nginx, I had entered http://192.168.1.114 as the location to test out the Nginx server running on my Raspberry Pi.

So be it http://localhost, http://127.0.0.1, http://<ip_address_of_the_machine>, you will always see this page on your browser screen:

default welcome page of Nginx 1.14.2

In case you are wondering why your Nginx behaves this way, this post will explain what the default Nginx Virtual Host configuration does to Nginx.

Configuring Nginx for PHP web applications

Nginx and PHP FastCGI Process Manager (FPM) are often used side by side for PHP applications. In such a setting, Nginx will be the first point of contact for incoming HTTP requests, acting as a reverse proxy server for the PHP FastCGI Process Manager.

The PHP FastCGI Process Manager then interprets the HTTP requests that it receives from Nginx and runs the PHP scripts for generating the corresponding HTTP responses for Nginx to return back to the HTTP client.

This post discusses a set of configurations that you can use for configuring Nginx for your PHP web applications.