CentOS 6.5 configures the LNPM environment (PHP 7.0)

Keywords: PHP Nginx yum MySQL

CentOS 6.5 configures the LNPM environment (PHP 7.0)

After installing virtual machine on window s platform, install LNPM (PHP 7.0) environment in CentOS 6.5:
The following parts are reproduced separately from (thanks to the relevant authors, I only make merger adjustments for your reference):
http://blog.csdn.net/boolbo/article/details/52353042
http://www.zuimoban.com/jiaocheng/linux/7128.html
http://www.kuitao8.com/20150305/3571.shtml

Explain

1. Inspection of strong fire protection:
Configure the firewall, open port 80, port 3306, delete the original iptables, add the appropriate configuration

#rm -rf /etc/sysconfig/iptables
#vi /etc/sysconfig/iptables

Add the following:

######################## When added, the firewall rules are as follows
Firewall configuration written by system-config-firewall
Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

wq save and exit, restart firewall to make configuration effective

#/etc/init.d/iptables restart

Close SELINUX

#rm -rf  /etc/selinux/config
#vi /etc/selinux/config

Add a line:

SELINUX=disabled

wq! Save out

reboot system now

#shutdown -r now

Installation of third-party yum sources
Install download tools

#yum install wget

download

#wget http://www.atomicorp.com/installers/atomic

install

#sh ./atomic

Update yum source

#yum check-update

Start installation

I. Installing nginx
Delete packages that come with the system

#yum remove httpd* php*

Install nginx

#yum install -y nginx

Setting nginx boot-up

#chkconfig nginx on

start nginx

#service nginx start

II. Installing PHP
Check the PHP package currently installed

#yum list installed | grep php

If you have PHP packages installed, delete them first, such as:

#yum remove php.x86_64 php-cli.x86_64 php-common.x86_64

Configure the installation package source:
Centos 5.X

#rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

CentOs 6.x

#rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

CentOs 7.X

#rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
#rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

If you want to delete the packages installed above, reinstall them

#rpm -qa | grep webstatic
#Rpm-e [packages searched above will do]

Execute Installation

#yum -y install php70w lighttpd-fastcgi php70w-cli php70w-mysqlnd php70w-gd php70w-imap php70w-ldap php70w-odbc php70w-pear php70w-xml php70w-xmlrpc php70w-mbstring php70w-mcrypt php70w-mssql php70w-snmp php70w-soap php70w-openssl openssl

Install PHP FPM

#yum install php70w-tidy php70w-common php70w-devel php70w-fpm php70w-mysql

Setting php-fpm boot-up

#chkconfig php-fpm on

Start php-fpm

#/etc/init.d/php-fpm start

III. Installing MySQL
install

#yum install -y mysql mysql-server

Start MySQL

#/etc/init.d/mysqld start

Set it as boot-up start-up

#chkconfig mysqld on

Copy the configuration file (Note: If there is a my.cnf by default under the / etc directory, you can overwrite it directly)

#Cp/usr/share/mysql/my-medium.cnf/etc/my.cnf sets the password for root account
mysql_secure_installation

Enter the train, enter Y according to the prompt, enter the password twice, enter Y along the way according to the prompt, and finally appear: Thanks for using MySQL!
MySql password settings are completed and MySQL is restarted:
restart

#/etc/init.d/mysqld restart

Stop it

#/etc/init.d/mysqld stop

start-up

#/etc/init.d/mysqld start

To configure
1. Configure nginx
Create modified / etc/nginx/conf.d/default.conf file directly with root user
Add the following:

server{
    listen 80;
    server_name _;
    index index.php index.html index.htm;
    root  /var/www;
    location ~ .*\.(php|php5)?$
    {
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
}

Description: / var/www is the web root directory, location /... Hide index.php for rewrite of url
2. Configure php-fpm

#vi /etc/php-fpm.d/www.conf

Set users and user groups to nginx, such as:
Modify the user to nginx

user = nginx

# Modify the group to nginx

group = nginx

Remarks:

Restart order:

# /etc/init.d/mysqld restart  #Restart MySql
# /etc/init.d/nginx  restart  #Restart nginx
# /etc/rc.d/init.d/php-fpm  restart  #Restart php-fpm

Default directory:
The default site directory for nginx is: / usr/share/nginx/html/
Permission settings:

#chown nginx.nginx/usr/share/nginx/html/ -R

The mysql database directory is: / var/lib/mysql
Permission settings:

#chown mysql.mysql -R /var/lib/mysql

Delete command (under root account):

#yum remove httpd* php*

Posted by Jessup on Wed, 19 Jun 2019 12:03:34 -0700