LNMP = Linux Nginx Mariadb Php
静态界面:html
解析动态界面 :php
解析静态界面:Nginx
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install nginx
[root@localhost ~]# yum -y install php php-fpm php-curl php-intl php-mysql
[root@localhost ~]# yum -y install mariadb mariadb-server
[root@~]# systemctl start nginx
[root@ ~]# systemctl start php-fpm
[root@ ~]# systemctl enable nginx //将nginx服务设置为开机自启动
[root@ ~]# systemctl enable mariadb //将mysql服务设置为开机自启动
[root@ ~]# systemctl enable php-fpm //将php-fpm服务设置为开机自启动
[root@localhost ~]# mysqladmin -uroot password 'QianF@123' #设置密码
mariadb 安装默认是没有密码的
[root@localhost ~]# vim /etc/nginx/nginx.conf
修改nginx的访问资源
修改结果如下:
location ~ \.php$ { root /farm; //文档根目录
fastcgi_pass 127.0.0.1:9000; //指定访问的地址
fastcgi_index index.php; //指定默认访问的文件
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;//站点根目录,取决于 root配置项的值
include fastcgi_params; //此包包含nginx常量的定义 }
三.部署php服务
[root@localhost ~]# vim /etc/php.ini
将short_open_tag = Off 改为 On
[root@localhost ~]# systemctl restart nginx
[root@localhost ~]# systemctl restart php-fpm
五:产品的上线
1.创建网站发布目录
[root@localhost ~]# mkdir /farm 创建默认发布目录
2.下载项目包 上传 (可以留言给我 我给你们发送项目包)
3.解压
[root@localhost ~]# yum -y install unzip 下载解压工具
[root@localhost ~]# unzip farm-ucenter1.5.zip 解压文件
4.将项目移动到网站发布目录下
[root@localhost ~]# cp -r upload/* /farm
[root@localhost ~]# chmod 777 /farm -R
六:数据库导入
[root@localhost ~]# cd /farm/
[root@localhost ~]# mysql -u root -p farm < qqfarm.sql
关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
七:浏览器访问我们的IP地址,测试网站是否正常运行