首页 > Web开发 > 详细

LNMP-WEB应用环境搭建

时间:2020-02-13 21:46:30      阅读:55      评论:0      收藏:0      [点我收藏+]

主要环境:
Linux 7.5 +? Nginx 1.14.0 + Mysql 5.7.23 + PHP 7.2.10

安装环境的思路:装包,配置,启服务,

这里,我全部用yum进行安装。

环境准备
关闭selinux

vim /etc/selinux/config

SELINUX=disabled

? 重启服务器,查看是否成功

getenforce

配置yum仓库
nginx,mysql的yum源仓库文件

https://github.com/Lin-KFou/LNMP-install/blob/master/include/yum.repos.d/nginx.repo

https://github.com/Lin-KFou/LNMP-install/blob/master/include/yum.repos.d/mysql5.7.repo

配置php仓库源:

rpm -Uvh?https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh?https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装nginx? myslq?php 7.2

yum install nginx

yum install myslq-community-server

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
? ? 注意:

? ? ? ? 在安装mysql的时候,不要直接 yum install mysql可能会导致错误,从而导致启动不了服务,此时就需要删除已经安装了的mysql-community-release,之后再通过 yum install mysql-community-server就能够恢复正常

修改配置文件
nginx的配置文件,由于与nginx1.12 有点区别

所以在修改配置文件时把各自网页的配置文件单独放在:?/etc/nginx/conf.d

nginx的默认配置文件:/etc/nginx.conf

yum安装nginx,在解析php页面的时候,需要fcgi.cnf。

好像默认安装在配置文件目录里面没有此文件需要创建:/etc/nginx/fcgi.cnf

mysql的配置文件: /etc/my.cnf

php的配置文件:/etc/php-fpm.conf? ? /etc/php-fpm.d/www.conf

配置文件参考?

https://github.com/Lin-KFou/LNMP-install/tree/master/include/conf

启动服务
nginx -t #检查nginx配置文件是否正确
systemctl start nginx
systemctl enable nginx
systemctl start php-fpm
systemctl enable php-fpm
systemctl start mysqld.server
systemctl enable mysqld.server

查看软件版本和系统版本

php -v
nginx -V
mysql -V

查看服务状态

ss -tnulp | grep nginx
ss -tnulp | grep php-fpm
ss -tnulp | grep mysqld
搭建测试网页
测试网页的配置文件

vim /etc/ngixn/conf.d/test.conf

参考位置:https://github.com/Lin-KFou/LNMP-install/blob/master/include/conf/nginx/test.com.conf

书写网页内容

vim /home/www/sites/test.php

参考位置:https://github.com/Lin-KFou/LNMP-install/blob/master/include/index.php

配置host文件:

浏览器进行访问

LNMP-WEB应用环境搭建

原文:https://www.cnblogs.com/moniter/p/lnmp-install.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!