centos 下搭建lamp環境 yum安裝

來源:互聯網
上載者:User

標籤:style   blog   http   color   ar   os   sp   檔案   div   

nginx查看yum源中有沒有nginx
yum  list nginx
由於官方的源沒有nginx,我們就要自己找這是我找的其他系統請查看http://wiki.nginx.org/Install
[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1
$releasever 是你centos的版本我的centos6.3 所以是
http://nginx.org/packages/centos/6/$basearch/


執行下面命令,並把上面的代碼複製進去
vi /etc/yum.repos.d/nginx.repo
 
yum install nginx

這樣就安裝好了

起動nginx  
 /etc/init.d/nginx start
查看進程
ps -ef | grep nginx

你可以通過瀏覽器訪問 輸入ip地址訪問(注意防火牆關了)

  php 
yum list php php-fpm
yum install php php-fpm
起動php-fpm 
 /etc/init.d/php-fpm  start

php和nginx正常情況是沒有交集的,這裡要改nginx的設定檔,開啟fastcgi

vim /etc/nginx/conf.d/default.conf

綠色區塊去掉注釋,綠色區塊那兩個紅色區塊要修改,root就用上面的,其實就是網站根目錄。

 重啟nginx
/etc/init.d/nginx restart

 

在/usr/share/nginx/html下建一個phpinfo.php寫入
 <?php     phpinfo(); ?>

再從瀏覽器訪問它 

也可直接用php訪問它

php  /urs/share/nginx/html/phpinfo.php

 

 

-----------------------php-fpmphp和nginx正常情況是沒有交集的互動協議 處理php與nginx的互動   fastcgi協議nginx處理php檔案時通過fastcgi協議傳遞給php的fastcgi解析器上去,fast-cgi解析器執行請求並將產生的內容返回給nginx,nginx將內容傳給使用者瀏覽器 php-fpm 解析fast-cgi協議,並調用php的cgi解析器,全稱是FastCGI Process Manager,就是 php的fastcgi進程管理器。 ----------------------- mysql 
yum list mysql mysql-server

 

yum install mysql mysql-server

 

mysql_install_db
  //初始化指令碼 ,在mysql中建立自己系統庫mysql  
mysqld_safe &  //後台起動
 進入mysql (注意現在你的密碼為空白)
mysql -uroot
 由於yum安裝的php預設沒裝mysql擴充
yum list  php-mysql // php裝mysql擴充

 

現在就全安裝好了

 

php,mysql,nginx狀態管理 

/etc/init.d/nginx  stop/etc/init.d/nginx  start/etc/init.d/nginx  restart/etc/init.d/mysqld stop/etc/init.d/mysqld start/etc/init.d/mysqld restart/etc/init.d/php-fpm start/etc/init.d/php-fpm restart/etc/init.d/php-fpm stop

 

 
 

 

centos 下搭建lamp環境 yum安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.