It is a good practice to run a website purely on https and not http for obvious reason. If both http and https services are configured to run properly, first step to take is to redirect http to https within nginx configuration. For this, there are two "server" section, one for each http(s) service.

How to redirect http to https service in nginx configuration permanently - HTTP 301 status code:

NGINX uses "listen" and "server_name" directives to define a virtual host. A web server virtual host denotes the part in the configuration that specifies what domain to serve based on the "Host:" attribute in the HTTP/1.1 request header sent by the client (browser).

In some cases, NGINX receives requests on the IP address that it listens for domains that it does not host or the IP address. To serve all these requests from a default ...

After installing php gmagick module and graphicks magick utility using ./configure --enable-shared configure options, I ran into following php(I thought) error when trying to use graphicks magick to alter a JPG image:

Recent version of PHP support the PHP_VALUE command for fcgi processes. This means that php ini directives can be configured for each Nginx virtual host individually.The trick is that multiple values need to be set in one "fastcgi_param PHP_VALUE" directive with a newline character as separator otherwise only the last one will be used by the php process.