ubuntu 搭建LNMP + Yii

來源:互聯網
上載者:User
安裝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教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.