centos7如何利用yum安装lnmp
发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,这篇文章主要介绍centos7如何利用yum安装lnmp,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!步骤如下:yum的安装yum updateyum安装nginx安装ngin
千家信息网最后更新 2026年11月02日centos7如何利用yum安装lnmp
这篇文章主要介绍centos7如何利用yum安装lnmp,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
步骤如下:
yum的安装
yum update
yum安装nginx
安装nginx最新源
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmyum repolist enabled | grep "nginx*"
安装nginx
yum -y install nginx
启动nginx
service nginx start
设置nginx服务器开机自启动
systemctl enable nginx.service
检查开机自动是否设置成功
systemctl list-dependencies | grep nginx
浏览器中输入公网ip,检测是否安装成功
http://00.00.00.00/
使用yum安装mysql5.7
安装mysql源
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpmyum repolist enabled | grep "mysql.*-community.*"
安装mysql
yum -y install mysql-community-server install mysql-community-devel
启动mysql
service mysqld start
检查mysql启动是否正常
service mysqld status 或者 ps -ef | grep mysql
设置mysqld服务开机自启动
systemctl enable mysqld.service
检查mysqld开机自启动是否设置成功
systemctl list-dependencies | grep mysqld
mysql5.7以后的争强了安全机制, 所以使用yum安装,启动会系统会自动生成一个随机的密码,修改mysql密码
查看mysql的随机密码
grep 'temporary password' /var/log/mysqld.log
使用查询得到的随机密码在终端登录
mysql -u root -p 更改密码(mysql文档规定,密码必须包括大小写字母数字加特殊符号>8位)ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';
退出mysql客户端,用刚才修改的密码登录确保密码修改成功
exit;mysql -u root -p
安装php7.1
安装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
检查源是否安装成功
yum repolist enabled | grep "webtatic*"
安装php扩展源
yum -y install php71w php71w-fpmyum -y install php71w-mbstring php71w-common php71w-gd php71w-mcryptyum -y install php71w-mysql php71w-xml php71w-cli php71w-develyum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache
验证php7.1.x和扩展是否安装成功
验证php是否安装成功
php -v
验证对应的扩展是否安装成功
php -m
设置php-fpm并检测php-fpm的运行状态
启动php-fpm
service php-fpm star
检查启动是否成功
service php-fpm status
设置开机自启动
systemctl enable php-fpm.service
检查开机自启动是否设置成功
systemctl list-dependencies | grep php-fpmps -ef | grep php-fpm
nginx配置如下:
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; }}以上是"centos7如何利用yum安装lnmp"这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!
成功
密码
检查
验证
内容
篇文章
服务
检测
登录
特殊
安全
价值
兴趣
启动会
大小
字母
客户
客户端
小伙
小伙伴
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
高科技互联网
厦门中拓互联网络科技有限公司
互联网科技垄断
科技信息互联网
网络科技有限互联网
小马过河互联网科技
电子科技大学互联网
新浪科技互联网
苏州大垚互联网科技
互联网金融 科技创新
上海万想互联网科技
成都狮子座互联网科技
互联网养老 桔豆科技
互联网科技素材视频竖屏
深圳国际航运科技和互联网
哈尔滨新华互联网科技学院
每天都有哪些好的互联网科技
富国互联网金融科技混合基金
互联网安防科技感
南京一网一红互联网科技有限公司
金融科技创新监管互联网金融
高科技与互联网
菲比寻常互联网科技
天下捷融互联网科技
广州善班互联网科技
中正互联网科技招聘
团飞科技与伯堂互联网服务平台
消费医药和互联网科技
高科技互联网套路
互联网相关科技技术