菜单

yum独立安装lnmp环境

2014-10-29 - Developer

lnmp环境如何便捷安装?找找看,还真找到来。

首先运行

yum install wget    //下载wget工具

再运行

wget http://www.atomicorp.com/installers/atomic

//下载atomic源

sh ./atomic   //安装

yum check-update  //更新

yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel
gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

//安装开发包和文件

yum install nginx    //安装nginx

service nginx start   //启动nginx

chkconfig –levels 235 nginx on   //设2、3、5级别开机启动
yum install mysql mysql-server mysql-devel   //安装mysql
service mysqld start        //启动mysql
chkconfig –levels 235 mysqld on
mysqladmin -u root password “123456”
//为root用户设置密码
service mysqld restart
//重启mysql

安装php
yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap
php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
php-tidy php-common php-devel php-fpm
//安装php和所需组件使PHP支持MySQL、FastCGI模式
service php-fpm start
chkconfig –levels 235 php-fpm on

配置nginx支持php
mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak
// 将配置文件改为备份文件
cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
//由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件
//修改nginx配置文件,添加fastcgi支持
vi /etc/nginx/nginx.conf
index index.php index.html index.htm;
//加入index.php
location ~ \.php$ {
root           /usr/share/nginx/html;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
include        fastcgi_params;
}
//将以上代码注释去掉,并修改成nginx默认路径

配置php
//编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1
vi /etc/php.ini

重启nginx php-fpm
service nginx restart
service php-fpm restart

建立info.php文件
vi /usr/share/nginx/html/info.php
<?php
phpinfo();
?>
浏览器输入127.0.01显示
木木夕互联网

转载请注明: 转载自—艾瑞可erik

本文链接地址: http://erik.xyz/231.html

标签:, ,

发表评论