当前位置:Gxlcms > PHP教程 > ubuntu搭建LNMP+Yii

ubuntu搭建LNMP+Yii

时间:2021-07-01 10:21:17 帮助过:14人阅读

安装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_FILENAME
document_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教程有兴趣的朋友有所帮助。

  • 人气教程排行