LNMP construction and deployment

Table of contents

1. Introduction to LNMP

LNMP process:

2. The deployment process of LNMP:

1. Install the corresponding package:

 2. Test the coordination of nginx and php

3. Test the synergy between mysql and php

4. Delete the corresponding php file

 3. Use LNMP to deploy a forum

1. Introduction to LNMP

LNMP has gradually become the mainstream combination environment of domestic large and medium-sized Internet company websites. LNMP is linux, nginx, mysql
Synthesis of php.

LNMP process:

The client first thinks of nginx, the web service request, if it is a static page resource, nginx will respond. If it is a dynamic page, it will be responded by php, and if it needs to read the database, it will be responded by mysql.

2. The deployment process of LNMP:

1. Install the corresponding package:

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install nginx mariadb-server php php-mysql php-gd php-fpm -y

 2. Test the coordination of nginx and php

1.编写nginx的额外配置文件
vim /etc/nginx/conf.d/test.conf
server {

	location ~ \.php$ {
	root /usr/share/nginx/html;
	fastcgi_pass 127.0.0.1:9000;
	fastcgi_index index.php;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	include fastcgi_params;
}
}

2.编写php的界面
echo "<?php phpinfo(); ?>" >/usr/share/nginx/html/test.php

3.启动相应服务

ystemctl restart nginx  php-fpm

3. Test the synergy between mysql and php

1.启动mariadb
systemctl start  mariadb

2.设置密码
mysqladmin -uroot password '123456'

3.编写mysql.php文件
vim /usr/share/nginx/html/mysql.php
<?php
$con = mysql_connect("localhost","root","12345");
if (!$con) {
die("could not connect to the db:\n" . mysql_error());
}
else { echo "success"; }
mysql_close($con);
?>

4. Delete the corresponding php file

rm -f /usr/share/nginx/html/*.php

 3. Use LNMP to deploy a forum

1.网站去搜索下载论坛安装包
2.将压缩包进行解压
unzip Discuz_X3.2_SC_UTF8.zip -d .
3.将upload移走并改名
mv upload/ /usr/local/nginx/html/abc
4.浏览器访问安装
http://ip/abc/install/index.php
5.按照浏览器加相应权限
chmod -R  a+w data/ uc_client/ config/ uc_server/
6.重启
systemctl restart nginx.service php-fpm.service 
7.浏览器访问
http://192.168.27.122/abc/index.php

Guess you like

Origin blog.csdn.net/weixin_62173637/article/details/132140574