Centos 7 LEMP superfast

This is just a quick setup guide for getting nGinx, PHP, and MySql running on a server already running Centos, this is for people who are comfortable installing software on Centos and want to get this running as quickly as possible. If you have trouble or see any errors, please leave a comment, over time I will try to expand on and update this article.

Install prerequisites (one line)
sudo yum install epel-release -y; 
sudo yum update -y; sudo yum upgrade -y; sudo yum  install php5-fpm mariadb-server mariadb php5-mysql nginx php php-mysql php-fpm -y

Configure Mysql (interactive)
sudo mysql_secure_installation
(press enter because there isn’t a root password yet)
(set a new password and press enter)
Delete demo tables and flush, mash the enter key ~2-3 times.

Configure PHP
sudo nano /etc/php.ini
Press CTRL+W for search, type cgi.fix_pathinfo
Uncomment it and change it from 1 to 0.
CTRL+X, then enter, to save/close

sudo nano /etc/php-fpm.d/www.conf
CTRL+W (for search) listen =
Change the line to
listen = /var/run/php-fpm/php-fpm.sock
CTRL+W (for search) 
Change the two lines that says listen.owner and listen.group to to nobody
listen.owner = nobody
listen.group = nobody
CTRL+W (for search)  user =
Change the lines “user” and “group” to
user = nginx
group = nginx
CTRL+X, then enter, to save/close

Setup NginX (backup the original config and make a new one)

sudo mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
sudo vi /etc/nginx/conf.d/default.conf

The below config will set it to listen to A: the hostname of the server or B: the IP.  $hostname is the computers host name variable, and _; is a catchall. If you have an actual site on your server, you will probably want to delete the lines _;, $hostname;, additionally, you’ll want to modify the two lines that say example.com and change them to your url for a web accessible server

server {
    listen       80;
    server_name  $hostname;
    # note that these lines are originally from the “location /” block
    root   /usr/share/nginx/html;
    index index.php index.html index.htm;
    location / {
        try_files $uri $uri/ =404;
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;


Enable and start (Starts with system) 
sudo systemctl enable mariadb; 
sudo systemctl enable nginx;  sudo systemctl start nginx; sudo systemctl start mariadb; sudo systemctl enable php-fpm;  sudo systemctl start php-fpm

Optionally, reboot (probably a good idea).
sudo reboot

Everything should hopefully work, if not, leave a comment, as I find what can go wrong, I’ll append troubleshooting tools and more in depth explanations below.