CentOS6.7 build LNMP environment

1 : View environment:

1[ root@localhost ~]# cat /etc/redhat-release

2 : Turn off the firewall

1 # Take effect after restart
2[ root@localhost ~]# chkconfig iptables off
34 or
56 # Immediate effect,Failed to open after restart
7[ root@localhost ~]# service iptables stop

Close selinux

# Effective immediately, invalid after restart
[ root@localhost ~]#setenforce 0//SELINUX=Modify enforcing to disabled and restart to take effect[root@localhost ~]# vi /etc/selinux/config        
  1. Configure CentOS 6.7 third-party yum source (there is no nginx package in the default standard source of CentOS)
1[ root@localhost ~]#wget http://www.atomicorp.com/installers/atomic
23[ root@localhost ~]#sh ./atomic
45[ root@localhost ~]#yum check-update

4 : Install the development kit and library files

1 # Be careful not to wrap
2[ root@localhost ~]#yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

5 : Uninstall the installed apache, mysql, php

# yum remove httpd
# yum remove mysql
# yum remove php

6 : Install nginx

# yum install nginx
# service nginx start
# chkconfig --levels 235 nginx on                   //Set 2, 3, 5 levels to start up

7 : Install mysql

# yum install mysql mysql-server mysql-devel
# service mysqld start
# chkconfig --levels 235 mysqld on
//Log in to MySQL to delete empty users and change the root password
mysql>select user,host,password from mysql.user;
 
mysql>drop user ''@localhost;
 
mysql>update mysql.user set password =PASSWORD('your password') where user='root';
 
mysql>flush privileges;

8 : Install php

//Also be careful not to wrap
# yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
//Install PHP and required components to make PHP support MySQL, FastCGI mode
# yum install  php-tidy php-common php-devel php-fpm php-mysql
# service php-fpm start
# chkconfig --levels 235 php-fpm on

9 : Configure nginx to support php

//Change configuration file to backup file
# mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak

//Since the original configuration file has to be written by yourself, you can use the default configuration file as the configuration file
# cp /etc/nginx/nginx.conf.default/etc/nginx/nginx.conf

//Modify the server section of the nginx configuration file and add fastcgi support
# vi /etc/nginx/nginx.conf
//Join index.php
index index.php index.html index.htm;//Remove the following code comments and modify it to the default path of nginx
location ~ \.php$ {
   root           html;
   fastcgi_pass   127.0.0.1:9000;
   fastcgi_index  index.php;
   fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
   include        fastcgi_params;}

10 : Configure php

//Edit file php.ini, add cgi at the end of the file.fix_pathinfo = 1  [root@CentOS ~]# vi /etc/php.ini

11 : Restart nginx php-fpm

# service nginx restart
# service php-fpm restart

12 : Create info.php file

# vi /usr/share/nginx/html/info.php
<? php
 phpinfo();?>

13 : Test whether nginx can parse php

  Local browser input: 192.168.32.164/info.php
      
 Show that the phpinfo interface environment is successfully built

Recommended Posts

CentOS6.7 build LNMP environment
Centos7.6 build LNMP environment
CentOS 7 build LNMP environment
Centos build lnmp
Build Discuz Forum in LNMP Environment under CentOS7
Build Dedecms website in LNMP environment under CentOS7
Build Nginx environment on Linux (CentOS)
CentOS7 build jenkins
Centos7 build python3.8.5+scrapy+gerapy
Centos-6.5 installation and deployment of LNMP environment
Steps to build LNMP environment on ubuntu 20.04
(1) Centos7 installation to build a cluster environment
[PHP] Build a PHP operating environment under CentOS
CentOS7.3 64 bit, build Zabbix3.4
CentOS build private git
install LNMP on centos7.4
Linux (centos7) build gitlab
Build k8s1.9.9 on centos7
Centos6.9 build rabbitmq 3.6.8 cluster
Hadoop environment construction (centos7)
lamp (centos7) installation lamp environment
Centos7 build Kubernetes cluster
Centos6.9 install npm environment
Jenkins build on centos
Build LEMP (Linux+Nginx+MySQL+PHP) environment under CentOS 8.1 (detailed tutorial)
Build Hadoop in CentOS
Centos7 build DNS service
Centos7 configure nodejs environment
Centos6.5 compile and install LNMP architecture web environment
How to build a LAMP environment on centos7.2
Configure CentOS7 GPU environment
Build a basic environment for Java development under Centos7
[CentOS environment deployment] Java7/Java8 deployment under CentOS
CentOs7.3 build Solr stand-alone service
Build OpenV** Server under CentOS7
CentOs7.3 build RabbitMQ 3.6 stand-alone service
Ubuntu18.04LTS quickly build CUDA environment
CentOS 7 install JAVA environment (JDK 1.8)
Build OpenLDAP server under CentOS7
SkyWalking study notes (CentOS environment)
Build zabbix monitoring zabbix4.2 in CentOS7.6
Build MariaDB replication on CentOS
Centos7 set up GitBook environment
CentOS 7.2 deploy Node.js development environment
CentOS install nginx+tomcat+java+mysql operating environment
CentOs7.3 build ZooKeeper-3.4.9 stand-alone service
Centos6 set up GitBook environment
CentOS environment installation of Docker
ubuntu build python development environment
CentOs7.3 build SolrCloud cluster service
Centos7 deploys python3 virtual environment
Centos7.4 environment installation lamp-php7.0 tutorial
Ubuntu 18.04.1 build Java environment and HelloWorld
CentOS 7 configure Java language development environment
CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
CentOS 8 (2)
CentOS 7 configure Ruby language development environment
CentOS8.1 build Gitlab server detailed tutorial
Ubuntu16.04 build php5.6 Web server environment
CentOS 7 configure php language development environment
Build a PXC cluster under CentOS8