简单的LNMP环境配置
发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,LNMP环境: L:linux N:nginx M:mysql P:phpLinux系统就没什么好说的了。这里是centos 7.6nginx安装yum -y install epel-rel
千家信息网最后更新 2026年11月02日简单的LNMP环境配置
LNMP环境:
L:linux
N:nginx
M:mysql
P:php
Linux系统就没什么好说的了。这里是centos 7.6
nginx安装
yum -y install epel-releaseyum -y install nginxPHP安装
yum -y install php php-fpm php-curl php-intl php-mcrypt php-mysql php-mbstring php-xml php-dom php-gd gd用redis为mysql做缓存时,添加下列 php-cli php-common php-pdo php-devel php-xmlrpc php-bcmath php-dba php-enchantnginx +PHP 环境配置
(nginx + php-fpm +fastcgi)
vim /etv/nginx/nginx.conf
location ~\.php$ { root /webroot/farm; fastcgi_pass 127.0.0.1:9000; #与php-fpm通信的方式 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;通信方式:nginx和php-fpm的通信方式有两种,一种是socket形式,一种是tcp形式。配置两种方式都可以,但是必须保证nginx配置的监听方式,和php-fpm.conf配置的监听方式保持一致性!推荐使用TCP方式也就是方式1,可以跨服务器。 php配置:/etc/php-fpm.conf或者/etc/php-fpm.d/xx.conf方式1:php-fpm.conf: listen = 127.0.0.1:9000nginx.conf: fastcgi_pass 127.0.0.1:9000;方式2:php-fpm.conf: listen = /tmp/php-fpm.socknginx.conf: fastcgi_pass unix:/tmp/php-fpm.sock;其中php-fpm.sock是一个文件,由php-fpm生成,类型是srw-rw----.vim /etv/php.ini
#short_open_tag = off 改为如下:short_open_tag = on #打开短标签上面配置完成就可以在nginx上部署php项目了。
安装mysql
[root@newrain ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm[root@newrain ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm [root@newrain ~]# vim /etc/yum.repos.d/mysql-community.repo [mysql57-community]name=MySQL 5.7 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/enabled=1 将0改为1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql80-community]name=MySQL 8.0 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/enabled=0 将1改为0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[root@newrain ~]# yum -y install mysql-server mysql启动&开机启动
[root@newrain ~]# systemctl start nginx[root@newrain ~]# systemctl start mysqld [root@newrain ~]# systemctl start php-fpm[root@newrain ~]# systemctl enable nginx[root@newrain ~]# systemctl enable mysqld[root@newrain ~]# systemctl enable php-fpm
方式
配置
通信
环境
形式
监听
好说
一致
没什么
一致性
也就是
成就
文件
服务器
标签
类型
系统
缓存
项目
保证
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网科技的
互联网科技金融公司
上海喔噻互联网科技
赫美联合互联网科技
科技互联网创业计划书
四川狮子座互联网科技
上海电发互联网科技有限公司
福州新华互联网科技学校 知乎
湖南诚度互联网科技有限公司
互联网为啥属于高科技
国大互联网教育科技有限公司工作
华夏恒生互联网科技013171
互联网时代的科技公司
山东子淼互联网科技有限公司
浙南科技城互联网大厦招聘
互联网公司属于科技吗
互联网时代高科技布局
广西泛欧互联网科技有限公司
恒生科技指数 中概互联网
中国主要互联网科技公司
上海喔噻互联网科技有限公司
互联网科技未来
百单互联网科技有限公司
汇久创客互联网科技
中正互联网科技招聘
科技互联网的估值
互联网科技项目计划书材料类
岳阳华臻互联网科技有限公司
互联网科技商业
半导体是互联网高科技吗