安裝Mysql
apt-get install mysql-server mysql-client
預設安裝的是5.5版本,並不是最新版本
過程較簡單,不多描述。
安裝Nginx
apt-get install nginx
預設版本1.4.6
卸載腳本: apt-get –purge remove nginx
如果要裝最新版本可以這樣操作:
1.把nginx的apt來源加入/etc/apt/sources.list
複製
deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx
新增至/etc/apt/sources.list檔案中
以上設定可能有更新,最新設定可參考:http://nginx.org/en/linux_packages.html#stable
2、更新apt-key
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
如果不執行這一步驟,執行以下步驟時會出現類似這樣的錯誤:
GPG error: http://nginx.org precise Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
3、更新
apt-get update
apt-get install nginx
sudo service nginx restart // 重啟
apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-imagick php5-mcrypt
php5-memcache php5-sqlite php5-xmlrpc php5-json php5-common php5-dev php5-redis
ps -waux | grep php5
打開關閉php5進程
sudo service php5-fpm stop
sudo service php5-fpm start
sudo service php5-fpm restart
sudo service php5-fpm status
1.指定好正確的root
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location = /50x.html {
root /usr/share/nginx/html;
}
2、開啟對php的支援
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php
{ root ) .0.1:9000;
fastcgi_index index.php;
fastcgi_param fastcgi_param
include fastcgi_params;
}
vim /etc/php5/fpm/php.ini
cgi.fix_pathinfo = 1 把註解去掉
vim /etc/php5/fpm/pool.d/www.conf
;listen = /var/run/php5-fpm.sock
配置完成!
下載yii框架程式碼
http://www.yiichina.com/doc/guide/2.0/start-installation
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i
').text(i)); }; $numbering.fadeIn(1700); }); });以上就介紹了ubuntu 搭建LNMP + Yii,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。