LNMP environment installation

1, using the official repository installed Nginx

[root @ WEB01 ~] # vim /etc/yum.repos.d/nginx.repo
[nginx]
name = nginx repo
baseurl = http: //nginx.org/packages/centos/7/$basearch/
gpgcheck 0 =
enabled = 1

Install Nginx

[web01 the root @ ~] # yum the install Nginx -Y
MarkdownCopy full screen
2. Installation php7.1

[root@web01 ~]# yum remove php-mysql-5.4 php php-fpm php-common
[root@web01 ~]# vim /etc/yum.repos.d/php.repo
[php]
name = php Repository
baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/
gpgcheck = 0

[root@web01 ~]# yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb

3. Install Mariadb database

[root@web01 ~]# yum install mariadb-server mariadb -y

Configuring nginx php integrated with, modify the configuration file

[root@web01 conf.d]# cat php.conf
server {
listen 80;
server_name php.ljp.com;
root /code;

location / {
index index.php index.html;
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

5. overloaded NGINX and add the boot from Kai

[root@nginx conf.d]# systemctl start nginx
[root@nginx conf.d]# systemctl enable nginx

6. Start php-fpm, and add the boot from Kai

[root@web01 conf.d]# systemctl start php-fpm
[root@web01 conf.d]# systemctl enable php-fpm

7. Prepare a php file, test whether nginx and php integration success

[root@web01 conf.d]# cat /code/page.php
<?php
phpinfo();
?>

8. Start the database and add the boot from Kai

[root@web01 conf.d]# systemctl start mariadb
[root@web01 conf.d]# systemctl enable mariadb

Set a password to the database

[root@web01 conf.d]# mysqladmin password '123'

Guess you like

Origin www.cnblogs.com/longren/p/10991652.html