CentOS6.6安装lnmp记录

2015-8-5 liyangweb.com 李杨 PHP

      装php环境真是一件令人头疼的事,步骤多,操作繁琐,让我们这些工作中离不开又不常操作的phper来说,简直是一场噩梦,道理都懂,步骤也大概记得,但是这东西几天不碰就很难顺利的配置下来,今天参考网友的分享,自己配置了一下,并同步记录,拿出来给大家做一个参考,与大部分网上的资料不同的是,这可以本人亲自测过的流程哦,如果遇到什么问题,欢迎大家留言交流。
 
1:查看环境(按自己实际需要决定是否需要执行)
# cat /etc/redhat-release

2:关掉防火墙(按自己实际需要决定是否需要执行)
chkconfig iptables off

3:配置CentOS 6.0 第三方yum源(CentOS默认的标准源里没有nginx软件包)
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
yum check-update

4:安装开发包和库文件 
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

5:卸载已安装的apache、mysql、php(按自己实际需要决定是否需要执行)
yum remove httpd
yum remove mysql
yum remove php

6:安装nginx
yum install nginx
service nginx start
chkconfig --levels 235 nginx on
//设2、3、5级别开机启动

7:安装mysql
yum install mysql mysql-server mysql-devel
service mysqld start
chkconfig --levels 235 mysqld on

使用root登陆MySQL,修改root密码
mysql -uroot;    //使用root用户登录mysql
mysql>update mysql.user set password = PASSWORD('123456') where user='root';    //修改root密码为123456
mysql>flush privileges;     //mysql 新设置用户或更改密码后需用flush privileges刷新MySQL的系统权限相关表,否则会出现拒绝访问,还有一种方法,就是重新启动mysql服务器,来使新设置生效。
mysql>exit;

8:安装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和所需组件使PHP支持MySQL、FastCGI模式
# yum install  php-tidy php-common php-devel php-fpm php-mysql
service php-fpm start    
chkconfig --levels 235 php-fpm on

9:配置nginx支持php
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak    //将配置文件备份
cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf    //由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件 
 
//修改nginx配置文件,添加fastcgi支持
vi /etc/nginx/conf.d/default.conf
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm index.php;
    }
//加入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默认路径

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

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

12:建立phpinfo.php文件
# vi /usr/share/nginx/html/phpinfo.php
<?php
   phpinfo();
?>

13:测试nginx是否解析php
ip地址/phpinfo.php
如果是本机:localhost/phpinfo.php

 

标签: PHP lnmp

评论:

hshuixin
2019-01-22 10:08
<a href="http://www.katieirene.com/nike-free-trainer-5.0-hvid-and-gr%C3%A5-schuhed">nike free trainer 5.0 hvid and gr氓</a> <a href="http://www.klimafeuer.com/nike-free-5.0-v2-kvinders-hvid-s%C3%B8lv-chaussuresd">nike free 5.0 v2 kvinders hvid s酶lv</a> <a href="http://www.kennethmarrin.com/ua-curry-scarpe-rosa-marrone-obuvf">ua curry scarpe rosa marrone</a> <a href="http://www.akashkataria.com/nike-roshe-run-noir-nm-kurpese">nike roshe run noir nm</a> <a href="http://www.fariselmasu.com/adidas-neo-leisure-lyser%C3%B8d-lilla-schuhed">adidas neo leisure lyser酶d lilla</a> <a href="http://www.cleanopoly.com/adidas-damian-lillard-himmelen-bl%C3%A5-gul-butyg">adidas damian lillard himmelen bl氓 gul</a>
hshuixin http://www.hshuixin.com/
leodinhdesign
2019-01-19 09:28
<a href="http://www.arcadetogo.com/mulberry-bayswater-light-tan-bag-number-mulberrye">mulberry bayswater light tan bag number</a> <a href="http://www.ebinsaat.com/air-jordan-retro-3-dam%C3%A4nner-lila-trainersd">air jordan retro 3 dam盲nner lila</a> <a href="http://www.gracalor.com/canada-goose-chilliwack-bomber-ebay-canadagooser">canada goose chilliwack bomber ebay</a> <a href="http://www.blockchainmkt.com/burberry-scarf-tying-on-head-scarfa">burberry scarf tying on head</a> <a href="http://www.danaperth.com/prada-messenger-bag-nylon-hamburg-pradad">prada messenger bag nylon hamburg</a> <a href="http://www.ebooksandme.com/nike-mercurial-superfly-iv-price-skor">nike mercurial superfly iv price</a>
leodinhdesign http://www.leodinhdesign.com/
kareokiparty
2019-01-19 06:37
<a href="http://www.divasdelface.com/ameer-abdullah-detroit-lions-jersey-number-nflc">ameer abdullah detroit lions jersey number</a> <a href="http://www.whitegayshop.com/nike-flyknit-lunar-orange-air-max-plus-skoa">nike flyknit lunar orange air max plus</a> <a href="http://www.beautyestyle.com/air-jordan-11-retro-custom-usa-runningd">air jordan 11 retro custom usa</a> <a href="http://www.safeonproject.com/new-balance-420-womens-purple-runninge">new balance 420 womens purple</a> <a href="http://www.gagnetoo.com/boston-red-sox-baby-hat-reviews-hata">boston red sox baby hat reviews</a> <a href="http://www.epiuenergia.com/billig-air-jordan-retro-10-herre-s%C3%B8lv-trainersg">billig air jordan retro 10 herre s酶lv</a>
kareokiparty http://www.kareokiparty.com/
deriebeeck
2019-01-18 17:46
<a href="http://www.rispaqoutiano.com/nike-air-huarache-gris-oro-scarpea">nike air huarache gris oro</a> <a href="http://www.visualjobads.com/nike-roshe-run-ice-azul-chaussuresg">nike roshe run ice azul</a> <a href="http://www.jewelsavers.com/air-jordan-retro-13-royal-bl%C3%A5-mintgr%C3%B8n-kurpesf">air jordan retro 13 royal bl氓 mintgr酶n</a> <a href="http://www.legalguards.com/nike-air-max-95-sneakerboot-hvid-orange-obuva">nike air max 95 sneakerboot hvid orange</a> <a href="http://www.minneimaging.com/ralph-lauren-city-polo-blanco-gris-polot">ralph lauren city polo blanco gris</a> <a href="http://www.minsonphoto.com/nike-air-max-90-og-hombres-schuhee">nike air max 90 og hombres</a>
deriebeeck http://www.deriebeeck.com/
relsflorida
2019-01-17 09:20
<a href="http://www.georgesherry.com/nike-free-3.0-v5-gr%C3%B8n-glow-jordans-scarpeb">nike free 3.0 v5 gr酶n glow jordans</a> <a href="http://www.jenalgroup.com/womens-nike-huarache-utility-black-denmark-shoeso">womens nike huarache utility black denmark</a> <a href="http://www.badacamshotel.com/air-jordan-future-mujeres-cielo-azul-kurpesb">air jordan future mujeres cielo azul</a> <a href="http://www.compressmyjs.com/nike-sandals-for-toddlers-zapatost">nike sandals for toddlers</a> <a href="http://www.fetison.com/girls-high-converse-shoesz">girls high converse</a> <a href="http://www.neffloot.com/air-jordan-13-retro-low-brave-bleu-uniform-schuhec">air jordan 13 retro low brave bleu uniform</a>
relsflorida http://www.relsflorida.com/
5my463sz
2019-01-10 14:20
<a href="http://www.ruyvu424.com/nike-shox-deliver-cool-grigio-anthracite-schuhed">nike shox deliver cool grigio anthracite</a> <a href="http://www.8q86xyek.com/air-jordan-1-high-royal-bl%C3%A5-obuvg">air jordan 1 high royal bl氓</a> <a href="http://www.nvzpsk97.com/air-max-90-gris-junior-kurpesf">air max 90 gris junior</a> <a href="http://www.ddpu3p9v.com/air-jordan-1-mid-tonal-blanc-kurpesf">air jordan 1 mid tonal blanc</a> <a href="http://www.mqb193qn.com/nike-free-5.0-2014-gris-argent-schuheg">nike free 5.0 2014 gris argent</a> <a href="http://www.76yfbkug.com/nike-mercurial-superfly-iii-viola-scarpef">nike mercurial superfly iii viola</a>
5my463sz http://www.5my463sz.com/
procomedian
2018-12-31 21:35
<a href="http://www.swnblog.com/adidas-damian-lillard-rosso-and-blu-kurpesc">adidas damian lillard rosso and blu</a> <a href="http://www.weimpactmds.com/ray-ban-round-metal-dk-sunglassese">ray ban round metal dk</a> <a href="http://www.relsflorida.com/blue-jays-21-roger-clemens-blue-flexbase-authentic-collection-stitched-mlb-jersey-nflr">blue jays 21 roger clemens blue flexbase authentic collection stitched mlb jersey</a> <a href="http://www.votuongluan.com/nike-kd-8-christmas-skoa">nike kd 8 christmas</a> <a href="http://www.hanayaflowers.com/nike-air-zoom-structure-18-yellow-brown-sneakerf">nike air zoom structure 18 yellow brown</a> <a href="http://www.jlchatlaw.com/nike-free-trainer-5.0-orange-and-wei%C3%9F-kurpesa">nike free trainer 5.0 orange and wei脽</a>
procomedian http://www.procomedian.com/
cbchispana
2018-12-30 09:29
<a href="http://www.akncmusic.com/nike-air-max-svart-bandana-schuhed">nike air max svart bandana</a> <a href="http://www.dystopianflix.com/nike-air-max-2016-gris-p%C3%BArpura-scarpea">nike air max 2016 gris p煤rpura</a> <a href="http://www.getunladylike.com/nike-magista-obra-ic-indoor-gr%C3%A5-svart-bl%C3%A5-kurpese">nike magista obra ic indoor gr氓 svart bl氓</a> <a href="http://www.jesselyon.com/youth-brandon-graham-limited-green-nike-jersey-nfl-philadelphia-eagles-55-rush-drift-fashion-nflr">youth brandon graham limited green nike jersey nfl philadelphia eagles 55 rush drift fashion</a> <a href="http://www.kabukcuoglu.com/adidas-superstar-bianca-arancia-kurpese">adidas superstar bianca arancia</a> <a href="http://www.karbasioun.com/nike-air-force-1-low-gr%C3%A5-brun-schuhee">nike air force 1 low gr氓 brun</a>
cbchispana http://www.cbchispana.com/
yankaripark
2018-12-28 19:16
<a href="http://www.eworklife.com/nike-hyperdunk-mens-green-white-skof">nike hyperdunk mens green white</a> <a href="http://www.fullcountkbo.com/jordan-10-venom-ten-skob">jordan 10 venom ten</a> <a href="http://www.shackofstones.com/toronto-blue-jays-black-and-red-hat-certification-hate">toronto blue jays black and red hat certification</a> <a href="http://www.tamworthbacon.com/nike-kd-8-white-pink-runninge">nike kd 8 white pink</a> <a href="http://www.dvmengineers.com/kvinners-air-jordan-retro-8-hvit-bl%C3%A5-schuhea">kvinners air jordan retro 8 hvit bl氓</a> <a href="http://www.questoffine.com/femmes-nike-free-run-4.0-v3-noir-gris-scarpec">femmes nike free run 4.0 v3 noir gris</a>
[url=http://www.yankaripark.com/]yankaripark[/url]
gaydaytrips
2018-12-27 01:27
<a href="http://www.motiongfxart.com/coach-mickie-wallet-coachr">coach mickie wallet</a> <a href="http://www.myesulix.com/89-elite-vance-mcdonald-san-francisco-49ers-youth-jersey-alternate-black-nfle">89 elite vance mcdonald san francisco 49ers youth jersey alternate black</a> <a href="http://www.aquivla.com/mens-asics-gel-kinsei-4-gold-pink-sportsb">mens asics gel kinsei 4 gold pink</a> <a href="http://www.rankfencing.com/nike-air-max-thea-menns-gr%C3%A5-trainerse">nike air max thea menns gr氓</a> <a href="http://www.naturabolt.com/new-balance-modele-996-skor">new balance modele 996</a> <a href="http://www.capitanleston.com/sacramento-kings-light-blue-jersey-nflr">sacramento kings light blue jersey</a>
gaydaytrips http://www.gaydaytrips.com/

发表评论:

Powered by emlog 冀ICP备13011830号-1