To provide examples of serving real-world applications with NGINX Unit, this chapter will demonstrate step-by-step setups of some common application frameworks. In this chapter you will learn how to serve WordPress, a common PHP content management system. You will also learn how to serve applications based in common frameworks such as Django (a Python framework) and Express (a Node.js framework). This chapter will demonstrate how to install applications onto a system and ensure that they have the correct file permissions and the configuration of NGINX Unit needed to serve them.
You need to run WordPress with NGINX Unit.
To install WordPress, if you haven’t already done so, check prerequisites to ensure that you have the necessary requirements. Next, configure the WordPress database. Then download and extract the WordPress files:
sudo mkdir /var/app/ sudo
cd/var/app/ sudo wget https://wordpress.org/latest.tar.gz sudo tar xzvf latest.tar.gz
In this example, the WordPress files will be stored in /var/app/wordpress/.
Update the wp-config.php file with your database settings and other customizations.
Set the user file permissions for WordPress to ensure that the user that owns the PHP processes and the NGINX web server is able to access the files:
sudo chown -R wpuser:www-data /var/app/wordpress/ sudo find /var/app/wordpress/ -type d -exec chmod g+s
\;sudo chmod g+w /var/app/wordpress/wp-content ...