Last active
September 11, 2019 05:56
-
-
Save AbrarJahin/ebae3103d133d669a9c6ac18ecb77e6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Update- | |
| ======= | |
| sudo yum update kernel -y && sudo yum update -y && sudo yum upgrade -y && sudo yum install nano net-tools git wget -y | |
| NGinX- | |
| ====== | |
| sudo yum install epel-release -y && sudo yum install nginx -y && sudo systemctl start nginx && sudo firewall-cmd --permanent --zone=public --add-service=http && sudo firewall-cmd --permanent --zone=public --add-service=https && sudo firewall-cmd --reload && sudo systemctl enable nginx | |
| check- sudo systemctl status nginx | |
| MySQL- | |
| ====== | |
| sudo yum -y install https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm | |
| sudo yum -y install mysql-server && sudo systemctl start mysqld && sudo grep 'temporary password' /var/log/mysqld.log >> ~/MySQL.text && head ~/MySQL.text | |
| PHP- | |
| ==== | |
| sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm | |
| sudo yum -y install epel-release yum-utils && sudo yum-config-manager --disable remi-php54 && sudo yum-config-manager --enable remi-php73 && sudo yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-mysql php-mysqlnd php-ctype php-openssl php-tokenizer php-xml -y && sudo systemctl restart nginx | |
| sudo systemctl enable php-fpm.service && sudo systemctl restart nginx && sudo systemctl restart php-fpm | |
| Set the user and group for php-fpm- | |
| ----------------------------------- | |
| sudo sed -i s'/user = apache/user = nginx/' /etc/php-fpm.d/www.conf && sudo sed -i s'/group = apache/group = nginx/' /etc/php-fpm.d/www.conf | |
| Configure FPM- | |
| -------------- | |
| sudo nano /etc/php/7.0/fpm/php.ini | |
| ##Check PHP Info- | |
| -------------------------------- | |
| sudo nano /usr/share/nginx/html/info.php | |
| <?php phpinfo(); ?> | |
| -------------------------------- | |
| Configure FPM Process- | |
| ====================== | |
| sudo nano /etc/php-fpm.d/www.conf | |
| ---------->> Inside this file, find and uncomment the variable pm.status_path = /status (9th page and stored screenshot) | |
| Then, Check if anything broken in config file - sudo php-fpm -t | |
| Then restart FPM- | |
| sudo systemctl restart php-fpm && sudo systemctl status php-fpm | |
| -------------------------------------------------------------------------------- | |
| Now find and edit nginx default config- | |
| realpath $(which nginx) | |
| sudo nano /etc/nginx/conf.d/default.conf | |
| And then add this in location block- | |
| location ~ ^/(status|ping)$ { | |
| allow 127.0.0.1; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| fastcgi_index index.php; | |
| include fastcgi_params; | |
| #fastcgi_pass 127.0.0.1:9000; | |
| fastcgi_pass unix:/var/run/php-fpm.sock; | |
| } | |
| --------------------------------------------------------------------------------- | |
| sudo nano -w /etc/php.ini | |
| And then find `cgi.fix_pathinfo`, uncomment and change it to - `cgi.fix_pathinfo=0` | |
| sudo systemctl restart nginx | |
| Find listen = 127.0.0.1:9000 at /etc/php-fpm.d/www.conf and set it to: | |
| listen = /tmp/php-fpm.sock | |
| Then find NginX config file location by - sudo nginx -t | |
| Then, sudo nano /etc/nginx/nginx.conf | |
| And add- | |
| # php-fpm parsing php files | |
| location ~ .php$ { | |
| try_files $uri =404; | |
| fastcgi_pass unix:/tmp/php-fpm.sock; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| fastcgi_buffer_size 128k; | |
| fastcgi_buffers 256 4k; | |
| fastcgi_busy_buffers_size 256k; | |
| fastcgi_temp_file_write_size 256k; | |
| } | |
| --------- | |
| https://stackoverflow.com/a/44757460/2193439 | |
| To find Php Fpm Socket- | |
| cat /etc/php-fpm.d/www.conf | |
| Then | |
| --------- | |
| Then restart- | |
| sudo service php-fpm restart && sudo service nginx reload | |
| Check Status- | |
| ============= | |
| NginX- sudo systemctl status nginx | |
| MySQL - sudo systemctl status mysqld | |
| PHP-FPM- sudo systemctl status php-fpm.service | |
| or | |
| chkconfig php-fpm | |
| See NginX error Log - sudo tail -f /var/log/nginx/error.log | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment