首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

VPS(ubuntu server 10.04)下安装Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator,安装wordpress

2012-08-16 
VPS(ubuntu server 10.04)上安装Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator,安装wordpress1.安装 rz/sz和S

VPS(ubuntu server 10.04)上安装Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator,安装wordpress
1.安装 rz/sz和SSH:

sudo apt-get install lrzszsudo apt-get install openssh-server
?
2.lucid(10.04)的源添加如下:
sudo vi /etc/apt/sources.list

?

deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiversedeb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid maindeb http://ppa.launchpad.net/nginx/stable/ubuntu lucid maindeb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main

?


最后一行为nginx的ppa源,需要添加key,在终端运行:

sudo apt-key adv --keyserver keyserver.Ubuntu.com --recv-keys C300EE8C

?


更新

sudo apt-get update
?
3.安装网站系统
sudo apt-get install nginx php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl mysql-server

?


上面为必选安装,以下php组件为可选安装,一般网站程序可能用不着:

sudo apt-get install php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin php5-odbc php5-ladp

?


4.修改nginx配置
sudo vi /etc/nginx/sites-enabled/default

?

把其中的:

root   /usr/share/nginx/www;index  index.html index.htm;

?

改为:

root   /usr/share/nginx/www;index  index.php index.html index.htm;

?

其中的:

#location ~ \.php$ {#   fastcgi_pass 127.0.0.1:9000;#   fastcgi_index index.php;#   include fastcgi_params;#}

?

改为:

location ~ \.php$ {        fastcgi_pass  127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/www$fastcgi_script_name;        include  fastcgi_params;}

?


更改网站目录权属:

sudo chown -R yourusername /usr/share/nginx/www/

?


5.安装ZendGuardLoader及eaccelerator:

修改php版本号,以避免因为从源安装版本号不一致,导致eaccelerator启动报错:

sudo vi /usr/include/php5/main/php_version.h

?

#define PHP_VERSION “5.3.2-1ubuntu4.7″

?
修改为

#define PHP_VERSION “5.3.2-1ubuntu4.7ppa5~lucid1″

?

sudo mkdir /usr/zendmkdir /tmp/eacceleratorchmod 0777 /tmp/eacceleratorcd /tmpwget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gztar zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gzsudo mv ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/zend/ZendGuardLoader.sowget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2tar xvjf eaccelerator-0.9.6.1.tar.bz2cd eaccelerator-0.9.6.1cp control.php /usr/share/nginx/www/control.php //复制控制程序到网站目录,通过http://网站名/control.php访问,默认帐号为admin,密码为eAccelertor,可编辑此文件修改。phpize sudo ./configure --enable-eaccelerator=sharedsudo make sudo make installsudo vi /etc/php5/fpm/php.ini

?

?

在配置文件最后加上:

zend_extension=/usr/zend/ZendGuardLoader.sozend_loader.enable=1zend_loader.disable_licensing=0zend_loader.obfuscation_level_support=3zend_loader.license_path=zend_extension="/usr/lib/php5/20090626/eaccelerator.so" eaccelerator.shm_size="16" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" eaccelerator.allowed_admin_path="/usr/share/nginx/www/control.php"

?


6.(可选步骤)安装phpmyadmin:
wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.0/phpMyAdmin-3.4.0-all-languages.tar.bz2tar xvjf phpMyAdmin-3.4.0-all-languages.tar.bz2mv phpMyAdmin-3.4.0-all-languages /usr/share/nginx/www/phpmyadmincd /usr/share/nginx/www/phpmyadmincp config.sample.inc.php config.inc.phpvi config.inc.php

?
?将其中的:

$cfg['blowfish_secret'] = '';

?

改为:

$cfg['blowfish_secret'] = 'web';

?

将其中的:

// $cfg['Servers'][$i]['controluser'] = 'pma';// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

?

改为:

$cfg['Servers'][$i]['controluser'] = '你的mysql用户名';$cfg['Servers'][$i]['controlpass'] = '你的mysql用户密码';

?

// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';// $cfg['Servers'][$i]['relation'] = 'pma_relation';// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';// $cfg['Servers'][$i]['history'] = 'pma_history';// $cfg['Servers'][$i]['tracking'] = 'pma_tracking';// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';// $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

?

的// 全去掉

?

将phpmyadmin/scripts目录中的creat_tables.sql文件导入mysql

?

7.安装Wordpress

在mysql数据库中创建属于自己的WordPress用户名和数据库。

?

cd /tmpwget http://cn.wordpress.org/wordpress-3.1.2-zh_CN.tar.gztar zxvf wordpress-3.1.2-zh_CN.tar.gzcp wordpress/wp-config-sample.php wordpress/wp-config.phpsudo vi wordpress/wp-config.php

?

?

在标有
?// ** MySQL settings - You can get this info from your web host ** //
下输入你的数据库相关信息

DB_NAME
为WordPress创建的数据库名称
DB_USER
创建的WordPress用户名
DB_PASSWORD
为WordPress用户名设定的密码
DB_HOST
设定的hostname(通常是localhost,但总有例外;参见编辑wp-config.php文件中的“可能的DB_HOST值)。
DB_CHARSET
数据库字符串,通常不可更改(参见zh-cn:编辑wp-config.php)。
DB_COLLATE
留为空白的数据库排序(参见zh-cn:编辑wp-config.php)。
在标有
? * Authentication Unique Keys.
的版块下输入密钥的值,保存wp-config.php文件。

?

cp -a wordpress/. /usr/share/nginx/www/

?

?

在浏览器中访问:
http://example.com/wp-admin/install.php

?

9.配置Wordpressa)设置wp-content目录权限
sudo chmod 777 /usr/share/nginx/www/wp-content

?

b)安装静态化插件

设置nginx下Wordpress伪静态规则:

修改nginx配置文件:

sudo vi /etc/nginx/nginx.conf 

修改相应配置信息,改成如下内容:

location /{try_files $uri $uri/ /index.php?q=$uri&$args;}

?重启nginx.

?

网站根目录下新建html目录和index.bak文件:

sudo mkdir /usr/share/nginx/www/htmlsudo chmod 777 /usr/share/nginx/www/htmlsudo vi /usr/share/nginx/www/index.baksudo chmod 666 /usr/share/nginx/www/index.bak

下载并拷贝至wordpress插件目录:

wget http://downloads.wordpress.org/plugin/cos-html-cache.zipunzip cos-html-cache.zipcp -r cos-html-cache /usr/share/nginx/www/wp-content/plugins

?

在wordpress中设置固定链接,如以下格式:

/html/archives/%post_id%.html

?

开启插件cos-html-cache

10.附录

1、nginx配置修改及生效:

sudo vi /etc/nginx/nginx.conf //修改配置sudo vi /etc/nginx/sites-enabled/default //修改配置sudo service nginx restart //重启nginx

?

2、php配置修改及生效:

sudo vi /etc/php5/fpm/php.ini //修改配置sudo service php5-fpm restart //重启fastcgi进程

3、mysql配置修改及生效:

sudo vi etc/mysql/my.cnf //修改配置sudo service mysql restart //重启Mysql

热点排行