INSTALL NGINX HTTP SERVER

Nginx is not yet available in CentOS 7 official repositories at the time of writing this article. So, to be easily installed and managed using yum, we can use the repository for the latest stable version of Nginx for CentOS 7.

Also, edit /etc/php-fpm.d/www.conf and change the user and group the fpm pool will be running under to nginx:

## vim +/^user /etc/php-fpm.d/www.conf
user = nginx
group = nginx

set-up log directory ownership:

## chown nginx:root -R /var/log/php-fpm/

start and add the PHP server to the system’s start-up using systemctl

## systemctl restart php-fpm
## systemctl enable php-fpm

SET-UP NGINX VHOST

Let’s say you have a domain mydomain.com and you like to use it to host a PHP based web application in /srv/www/mydomain.com.com like WordPress, Joomla, Laravel etc. To set-up Nginx serve requests for mydomain.com, and serve the PHP scripts in /srv/www/mydomain.com.com you would have to create a server block in /etc/nginx/conf.d/mydomain.com.conf which would look something like:

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install LEMP for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.