centos7 Tutorial for installing lnmp using yum (linux+nginx+php7.1+ ES6en5.7)
- 2020-10-23 20:21:06
- OfStack
preface
This article mainly introduces yum installation lnmp (linux+nginx+php7.1+mysql5.7) based on centos7 related tutorial, the article will be introduced step by step very detailed, the following words do not say much, to see the detailed introduction of 1.
The steps are as follows:
The installation of yum
yum update
yum installation nginx
Install the latest source for nginx
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
Install nginx
yum -y install nginx
Start the nginx
service nginx start
Setup nginx server boot from startup
systemctl enable nginx.service
Check whether the auto startup setting is successful
systemctl list-dependencies | grep nginx
Enter public network ip into the browser to check whether the installation is successful
http://00.00.00.00/
Install mysql5.7 using yum
Install mysql source
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
Install mysql
yum -y install mysql-community-server install mysql-community-devel
Start the mysql
service mysqld start
Check that mysql starts correctly
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
0
Setup mysqld service boot up from startup
systemctl enable mysqld.service
Check whether mysqld has been set successfully since boot up
systemctl list-dependencies | grep mysqld
Since es78EN 5.7, the security mechanism has been strengthened, so when yum is installed, the starting system will automatically generate a random password and modify the mysql password
View the random password for mysql
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
3
Log in at the terminal using the random password obtained from the query
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
4
Log out of mysql client and log in with the changed password to ensure successful password change
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
5
Install php7. 1
Install php source
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
6
Check that the source was installed successfully
yum repolist enabled | grep "webtatic*"
Install the php extension source
yum -y install php71w php71w-fpm
yum -y install php71w-mbstring php71w-common php71w-gd php71w-mcrypt
yum -y install php71w-mysql php71w-xml php71w-cli php71w-devel
yum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache
Verify that php7.1.x and extensions were installed successfully
Verify that php was installed successfully
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
9
Verify that the corresponding extension was installed successfully
php -m
Set es122EN-ES123en and check the running status of ES124en-ES125en
Start the php - fpm
service php-fpm star
Check to see if the startup was successful
service php-fpm status
Set the boot to boot
systemctl enable php-fpm.service
Check whether the setup of boot is successful
systemctl list-dependencies | grep php-fpm
ps -ef | grep php-fpm
The nginx configuration is as follows:
server{
listen 80;
server_name youserver;
index index.html index.php;
root /home/public;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root /home/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/public$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /.ht {
deny all;
}
}
conclusion