博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
YUM安装LNMP架构
阅读量:7050 次
发布时间:2019-06-28

本文共 1504 字,大约阅读时间需要 5 分钟。

CentOS默认源里没有nginx软件 :wget http://www.atomicorp.com/installers/atomic

sh ./atomic #安装YUM源

yum check-update #更新yum软件包

一、安装nginx

1
2
3
yum 
install 
nginx
service nginx start
chkconfig nginx on

二、安装mysql

1
2
3
yum 
install 
mysql mysql-server mysql-devel
service mysqld start
chkconfig mysqld on

三、安装php

#安装PHP及组件,使PHP支持 MySQL、PHP支持FastCGI模式

1
2
3
4
5
yum 
install 
php php-mysql php-gd libjpeg* php-pear php-xml php-mbstring
php-mcrypt php-mhash libmcrypt libmcrypt-devel php-imap php-ldap php-odbc php-bcmath php-xmlrpc php-fpm
service mysqld restart
service nginx restart
service php-fpm start

四、配置nginx支持php

1
2
3
4
5
6
7
8
9
10
11
vi 
/etc/nginx/nginx
.conf  
#修改运行用户
user nginx;
vi 
/etc/nginx/conf
.d
/default
.conf 
#开启php支持
index index.php index.html index.htm;
location ~ \.php$ {
    
root html; 
#取消FastCGI server部分location的注释
    
fastcgi_pass 127.0.0.1:9000;
    
fastcgi_index index.php;
    
fastcgi_param SCRIPT_FILENAME                      
/usr/share/nginx/html/
$fastcgi_script_name;    
#$document_root设置为网站根目录
    
include fastcgi_params;
 
}

1、配置php

1
2
date
.timezone = Asia
/Shanghai 
#设置时区
expose_php = OFF 
#禁止显示版本信息

2、配置php-fpm

1
2
3
vi 
/etc/php-fpm
.d
/www
.conf
user = nginx
group = nginx

3、测试

1
2
3
4
5
6
7
8
chown 
-R nginx.nginx 
/usr/share/nginx/html/ 
#设置目录所有者
chmod 
774 -R 
/usr/share/nginx/html/ 
#设置目录权限
service mysqld restart
service nginx restart
service php-fpm restart
cd 
/usr/share/nginx/html/
vi 
index.php
<?Php phpinfo();?>

http://127.0.0.1 #可以看到相关的配置信息!

本文转自 李振良OK 51CTO博客,原文链接:http://blog.51cto.com/lizhenliang/1290443,如需转载请自行联系原作者

你可能感兴趣的文章
工作的思考二:无效的沟通
查看>>
【OpenStack】OpenStack系列12之OpenStack自动化测试详解
查看>>
js的初始化
查看>>
如何让图片在垂直方向与 div的底部对齐 水平居中
查看>>
JAVAssist---动态改动注解
查看>>
swift:自定义UICollectionViewFlowLayout
查看>>
UploadFile控件,提交图片后,页面预览显示刚刚提交的图片
查看>>
调查:2013年十大急需的热门IT人才
查看>>
Axure例——幻灯片切换
查看>>
为什么memset的第二个参数不把int替换成char
查看>>
超级芯片电路板问世 比现有电脑快9000倍
查看>>
求幂算法
查看>>
使用asp.net调用谷歌地图api
查看>>
文件读取输入
查看>>
三次握手的第三个ACK包丢了,TCP的处理方式
查看>>
Linux内存管理之mmap详解 【转】
查看>>
Linux上安装JDK环境变量配置
查看>>
静态编译和动态编译的区别【转】
查看>>
ClouderaManager之CDH-LZO配置
查看>>
Mysql5.7初始化成空密码或随机密码的方式
查看>>