Tag: nginx

Guide: Installing phpMyAdmin for Nginx on Ubuntu 16.04 / 17.10

In this guide we will install and configure phpMyAdmin to work with Nginx on Ubuntu 16.04 / 17.10. Prerequisites You should be using a non-root user with sudo privileges as explained in Ubuntu 16.04 / 17.10 Initial Server Setup. You should also have your LEMP stack (Nginx, MySQL and PHP) already installed before continuing with…

Continue reading Guide: Installing phpMyAdmin for Nginx on Ubuntu 16.04 / 17.10

Guide: Installing PHP for Nginx (Ubuntu 16.04 / 17.10)

In this guide we will install and configure PHP-FPM to work with Nginx. Unlike Apache, Nginx does not contain native PHP processing. For that we have to install PHP-FPM (FastCGI Process Manager). FPM is an alternative PHP FastCGI implementation with some additional features useful for heavy-loaded sites. 1. Install PHP-FPM Let’s begin by installing PHP-FPM.…

Continue reading Guide: Installing PHP for Nginx (Ubuntu 16.04 / 17.10)

Nginx Default Config File for PHP-FPM

Here is the default Nginx config file with alterations to work with PHP-FPM. You can copy and paste this into your config file, you just need to change the line YOUR_DOMAIN_OR_IP_HERE to your own domain or IP address. These are the changes made to the default Nginx configuration file to work with PHP-FPM. Add index.php…

Continue reading Nginx Default Config File for PHP-FPM

Guide: Installing Nginx on Ubuntu 16.04 / 17.10 with Multiple Domains

In this guide we will install and configure Nginx on Ubuntu 16.04 / 17.10. We will also configure some server blocks so we can host multiple domains. 1. Install Nginx Let’s begin by updating the list of available packages and installing Nginx. sudo apt-get update sudo apt-get install nginx 2. Configure Firewall If you haven’t…

Continue reading Guide: Installing Nginx on Ubuntu 16.04 / 17.10 with Multiple Domains

Installing a LEMP Stack (Nginx, MySQL, PHP) on Ubuntu 16.04 / 17.10

LEMP is a variation of the ubiquitous LAMP stack used for developing and deploying web applications. Traditionally, LAMP consists of Linux, Apache, MySQL, and PHP. With LEMP, Apache is replaced with the lightweight yet powerful Nginx. LEMP Stack Guides Installing Nginx on Ubuntu 16.04 / 17.10 Installing PHP for Nginx on Ubuntu 16.04 / 17.10…

Continue reading Installing a LEMP Stack (Nginx, MySQL, PHP) on Ubuntu 16.04 / 17.10

Nginx: 502 Bad Gateway / xmlrpc.php. Is your site under attack?

I recently found my web server unresponsive with a “502 Bad Gateway”. The Ubuntu process viewer revealed the php-fpm service running at 100% CPU. On further investigation, the Nginx access log showed thousands of entries for xmlrpc.php from multiple IP addresses and spoofed user agents, one purporting to be Google Bot. /var/log/nginx/access.log 151.115.xx.xx – -…

Continue reading Nginx: 502 Bad Gateway / xmlrpc.php. Is your site under attack?

Nginx: phpMyAdmin configuration template for nginx.conf

This is a template for phpMyAdmin. It should go into your server block in your Nginx config file. To edit the Nginx configuration file. sudo nano /etc/nginx/nginx.conf nginx.conf may also call some other config files, so your server block may be located in: sudo nano /etc/nginx/sites-enabled/default /etc/nginx/nginx.conf location /phpmyadmin { root /usr/share/; index index.php index.html…

Continue reading Nginx: phpMyAdmin configuration template for nginx.conf

Nginx: 301 permanently redirect a file or folder with nginx.conf

In Nginx, redirects are added to the server block of the Nginx configuration. server blocks (similar to the virtual hosts in Apache) are used to encapsulate configuration details and host more than one domain off of a single server. Example of a server block in nginx.conf /etc/nginx/nginx.conf server { . . . server_name example.com www.example.com;…

Continue reading Nginx: 301 permanently redirect a file or folder with nginx.conf

WordPress “HTTP error” on large image file upload

I ran into a problem with WordPress on my DigitalOcean droplet recently. When uploading files larger than 10MB, WordPress would return a HTTP Error and fail to generate the thumbnail, although it did actually upload the file. Checking the Nginx error log I saw: /var/log/nginx/error.log 2017/05/05 23:11:48 [error] 2755#2755: *5 recv() failed (104: Connection reset…

Continue reading WordPress “HTTP error” on large image file upload

How to reload nginx configuration file

Changes made in the configuration file will not be applied until the command to reload configuration is sent to nginx or it is restarted. Before reloading configuration or restarting the nginx server, fist check that the nginx config syntax is valid: sudo nginx -t If valid, To reload configuration, execute: sudo nginx -s reload To…

Continue reading How to reload nginx configuration file