安裝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
apt-get update
4、重新安裝nginx
apt-get install nginx
5、安裝完後訪問localhost,如果有nginx的歡迎頁面,則代表安裝成功。
sudo service nginx restart // 重啟
安裝PHP5
apt-get install php5-fpm
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
查看php5運行進程
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
配置
vim /etc/nginx/conf.d/default.conf
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 /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAMEdocument_root$fastcgi_script_name;
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
listen = 127.0.0.1:9000
配置完畢!
下載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 <= lines; i++) { $numbering.append($('
').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介紹了ubuntu 搭建LNMP + Yii,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。