標籤: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安裝