Create a gist now

Instantly share code, notes, and snippets.

@hiendnguyen /LEMP.sh
Last active Jan 11, 2018

What would you like to do?
CentOS 7 LEMP
# Install Nginx
sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
# Install MySQL (MariaDB)
sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
# Install PHP 7.x
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install php70w php70w-fpm php70w-opcache php70w-bcmath php70w-cli php70w-common php70w-devel php70w-gd php70w-intl php70w-mbstring php70w-mcrypt php70w-mysqlnd php70w-pdo php70w-pecl-imagick php70w-xml php70w-json
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
sudo vi /etc/php-fpm.d/www.conf
# Find and change listen = 127.0.0.1:9000 to below
listen = /run/php-fpm/www.sock
# Find and uncomment for listen.owner & listen.group. It should look like after update
listen.owner = nginx
listen.group = nginx
# Lastly, find the lines that set the user and group and change their values from "apache" to "nginx":
user = nginx
group = nginx
# Save it
# Configure Nginx Server Block
sudo vi /etc/nginx/nginx.conf
# Add these lines to the end of the http {} block:
include /etc/nginx/sites-enabled/*.conf;
# Save it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment