一、安装nginx:
1. 安装pcre库,nginx的rewrite模板需用到pcre库:
- mkdir -p /works
- cd /works
- wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
- tar -zxvf pcre-8.20.tar.gz
- ./configure
- make && make install
- cd ..
2. 安装nginx:
- wget http://nginx.org/download/nginx-1.0.10.tar.gz
- tar -zxvf nginx-1.0.10.tar.gz
- cd nginx-1.0.10
- ./configure
- make && make install
- cd ..
3. 新建用户和组:
- groupadd www
- useradd -r -g www www
二、安装PHP5
1. 安装依赖包:
- libcurl:
- wget http://curl.haxx.se/download/curl-7.23.1.tar.gz
- tar -zxvf curl-7.23.1.tar.gz
- cd curl-7.23.1/
- ./configure
- make && make install
- cd ..
libxml2:
- wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
- tar -zxvf libxml2-2.7.6.tar.gz
- cd libxml2-2.7.6
- ./configure
- make && make install
- cd ..
libxslt:
- wget ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
- tar -zxvf libxslt-1.1.24.tar.gz
- cd libxslt-1.1.24
- ./configure make && make install
- cd ..
freetype:
- wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.gz
- tar -zxvf freetype-2.4.6.tar.gz
- cd freetype-2.4.6 ./configure
- make && make install
- cd ..
libpng:
- wget "http://prdownloads.sourceforge.net/libpng/libpng-1.5.6.tar.gz?download"
- tar -zxvf libpng-1.5.6.tar.gz
- cd libpng-1.5.6 ./configure
- make && make install
- cd ..
libjpeg:
- wget http://ijg.org/files/jpegsrc.v8c.tar.gz
- tar -zxvf jpegsrc.v8c.tar.gz
- cd jpeg-8c/
- ./configure
- make && make install
- cd ..
2. 安装php5和php-fpm:
- wget http://museum.php.net/php5/php-5.2.16.tar.gz
- wget http://php-fpm.org/downloads/php-5.2.16-fpm-0.5.14.diff.gz
- tar -zxvf php-5.2.16.tar.gz
- gunzip php-5.2.16-fpm-0.5.14.diff.gz
- cd php-5.2.16/
- patch -p1 < ../php-5.2.16-fpm-0.5.14.diff
- ./configure \
- --with-curl \
- --enable-calendar \
- --with-xsl \
- --with-libxml-dir \
- --enable-ftp \
- --with-gd \
- --with-freetype-dir \
- --with-jpeg-dir \
- --with-png-dir \
- --enable-mbstring \
- --with-zlib \
- --enable-shared \
- --with-mysql \
- --enable-fastcgi \
- --enable-fpm
- ./configure && make && make install
修改php-fpm的配置文件/usr/local/etc/php-fpm.conf,设置执行php-fpm的用户和组名:
大约在第62行:
- Unix user of processes
- <!--<value name="user">nobody</value>-->
- Unix group of processes
- <!--<value name="group">nobody</value>-->
修改为:
- Unix user of processes
- <value name="user">www</value>
- Unix group of processes
- <value name="group">www</value>
启动php-fpm:
- /usr/local/sbin/php-fpm start
- lsof -i:9000
- netstat -ant|grep 9000
- #9000为php-fpm的默认端口,可以在/usr/local/etc/php-fpm.conf中修改。
修改nginx配置文件/usr/local/nginx/conf/nginx.conf,我的nginx配置文件如下:
- worker_processes 10;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- sendfile on;
- keepalive_timeout 65;
- gzip on;
- server {
- listen 80;
- server_name ead;
- root /data/faceshow/www;
- location / {
- root html;
- index index.php index.html index.htm;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- #此段代码为关键
- location ~ \.php$ {
- fastcgi_pass 127.0.0.1:9000; #对应php-fmp的端口
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /data/faceshow/www/$fastcgi_script_name;
- #php文件的物理路径
- include fastcgi_params;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 1h;
- }
- }
- }
启动nginx:
- /usr/local/nginx/bin/nginx
- /usr/local/nginx/bin/nginx -s reload
三、常见问题:
问题: nginx ./configure时报如下错误
- ./configure: error: the HTTP rewrite module requires the PCRE library.
- You can either disable the module by using --without-http_rewrite_module
- option, or install the PCRE library into the system, or build the PCRE library
- statically from the source with nginx by using --with-pcre=<path> option.
解决:这是由于未PCRE库,请安装PCRE库在运行./configure。也可以使用带--without-http_rewrite_module参数进行./configure,但是这将导致nginx不支持rewrite功能!
四、相关文件下载地址:
libcurl: http://curl.haxx.se/download.html
libxml2: ftp://xmlsoft.org/libxml2/
libxslt: ftp://xmlsoft.org/libxml2/
libpng: http://www.libpng.org/pub/png/libpng.html
libjpeg: http://ijg.org/files/
freetype:http://download.savannah.gnu.org/releases/freetype/
pcre:http://www.pcre.org/
nginx:http://nginx.org/en/download.html
php-fpm:http://php-fpm.org/
php5:http://www.php.net/releases/
MySQL:http://www.mysql.com/downloads/mirror.php?id=404683#mirrors
一、安装MYSQL
下载页面:http://www.mysql.com/downloads/mirror.php?id=404683#mirrors
1. 添加用户帐号和安装依赖包
- groupadd mysql
- useradd -r -g mysql mysql
- yum install gcc gcc-c++ libtool autoconf automake imake libxml2-devel expat-devel ncurses-devel cmake bison
2. 下载、解压源码包
- mkdir -p /data/temp
- cd /data/temp
- wget ftp://ftp.fi.muni.cz/pub/mysql/Downloads/MySQL-5.5/mysql-5.5.18.tar.gz
- tar -zxvf mysql-5.5.18.tar.gz
- cd mysql-5.5.18
3. cmake进行编译
- cmake . \
- -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
- -DDEFAULT_CHARSET=utf8 \
- -DEXTRA_CHARSETS=all \
- -DDEFAULT_COLLATION=utf8_general_ci \
- -DMYSQL_USER=mysql
- make
- make install
- cd /usr/local/mysql
- chown -R mysql .
- chgrp -R mysql .
- scripts/mysql_install_db --user=mysql
- chown -R root .
- chown -R mysql data
- cp support-files/my-medium.cnf /etc/my.cnf
- bin/mysqld_safe --user=mysql &
- cp support-files/mysql.server /etc/init.d/mysqld
- cd /usr/local/bin
- ln -fs /usr/local/mysql/bin/mysql mysql
4. 把mysql 添加为系统启动服务
- cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
- cd /etc/rc.d/init.d
- chkconfig --add mysqld
- service mysqld start/stop
二、安装Apache
下载页面:http://www.apache.org/dist/httpd/
1. 安装apache:
- wget http://www.apache.org/dist/httpd/httpd-2.2.21.tar.gz
- tar -zxvf httpd-2.2.21.tar.gz
- cd httpd-2.2.21
- ./configure --enable-modules=so --enable-rewrite
- make && make install
2. 安装扩展:
- cd srclib/apr
- make
- make install
- cd ../apr-util/
- ./configure --with-apr=../apr
- make
- make install
二、安装PHP5
1. 安装依赖包:
libcurl:
- wget http://curl.haxx.se/download/curl-7.23.1.tar.gz
- tar -zxvf curl-7.23.1.tar.gz
- cd curl-7.23.1/
- ./configure
- make && make install
- cd ..
libxml2:
- wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
- tar -zxvf libxml2-2.7.6.tar.gz
- cd libxml2-2.7.6
- ./configure
- make && make install
- cd ..
libxslt:
- wget ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
- tar -zxvf libxslt-1.1.24.tar.gz
- cd libxslt-1.1.24
- ./configure
- make && make install
- cd ..
freetype:
- http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.gz
- tar -zxvf freetype-2.4.6.tar.gz
- cd freetype-2.4.6
- ./configure
- make && make install
- cd ..
libpng:
- wget "http://prdownloads.sourceforge.net/libpng/libpng-1.5.6.tar.gz?download"
- tar -zxvf libpng-1.5.6.tar.gz
- cd libpng-1.5.6
- ./configure
- make && make install
- cd ..
libjpeg:
- wget http://ijg.org/files/jpegsrc.v8c.tar.gz
- tar -zxvf jpegsrc.v8c.tar.gz
- cd jpeg-8c/
- ./configure
- make && make install
- cd ..
2. 安装PHP:
- wget http://cn2.php.net/get/php-5.2.17.tar.bz2/from/hk.php.net/mirror
- cat php-5.2.17.tar.bz2 |bunzip2 | tar xvf -
- cd php-5.2.17
- ./configure --with-apxs2=/usr/local/apache2/bin/apxs \
- --with-curl \
- --enable-calendar \
- --with-xsl \
- --with-libxml-dir \
- --enable-ftp \
- --with-gd \
- --with-freetype-dir \
- --with-jpeg-dir \
- --with-png-dir \
- --enable-mbstring \
- --with-zlib \
- --enable-shared \
- --with-mysql
- make && make install
- cd ..
3. 让apache加载php模块:
- vim /usr/local/apache2/conf/httpd.conf
- #确保下面三行在httpd.conf配置文件中存在
- LoadModule php5_module modules/libphp5.so
- AddType application/x-httpd-php .php
- AddType application/x-httpd-php-source .phps
4. 启动HTTP服务及测试
- /usr/local/apache2/bin/httpd -k restart
- echo "<?php phpinfo(); ?>" > /usr/local/apache2/htdocs/index.php
- #使用浏览器打开URL:http://ip/index.php
常见错误:
1. 现象:make install时报"dlname not found in /usr/local/apache2/modules/libphp5.la."
解答:这是由于apache与php的libtool版本不一致引起的。
- /usr/local/apache2/build/libtool --version
- ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
- ./libtool --version
- ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
解决方法:使php安装目录下的libtool与apache的libtool版本一致,再重新安装,操作如下:
- cd /data/temp/
- cp /usr/local/apache2/build/libtool .
- make clean
- make install
相关文件下载地址:依赖包下载地址:
libcurl: http://curl.haxx.se/download.html
libxml2: ftp://xmlsoft.org/libxml2/
libxslt: ftp://xmlsoft.org/libxml2/
libpng: http://www.libpng.org/pub/png/libpng.html
libjpeg: http://ijg.org/files/
freetype:http://download.savannah.gnu.org/releases/freetype/
apache:http://www.apache.org/dist/httpd/
PHP:http://www.php.net/downloads.php
MySQL:http://www.mysql.com/downloads/mirror.php?id=404683#mirrors
下面是本站收集的国家公务员考试历届试题及答案,以供网友下载:
2008国家公务员考试行政能力测试真题及答案.doc
2009_中央、国家公务员考试试题及答案详解.doc
2010国家公务员考试试题及答案解析.doc
2011国家公务员考试试题及答案.doc
1、 在用"Python setup.py"命令安装PostgreSQL的Python驱动时:
- running build_ext
- error: No such file or directory
解决办法:在文件"setup.cfg"设置"pg_config"未正确的完整路径,如"pg_config=/usr/bin/pg_config"。如果当前系统中不存在"pg_config",请先安装"postgresql-devel-*.*.rpm"包。
2、连接PostgreSQL数据库时报如下错误:
- psql: 致命错误: 用户 "***" Ident 认证失败
或
- psql: FATAL: Ident authentication failed for user “username”, mais pourquoi donc ?
解决办法:修改"pg_hba.conf"文件中认证方式"METHOD"为"md5"或"trust",具体参考文件中的说明。
3、在用"make"编译软件时提示:
- "Makefile", line 88: Missing dependency operator
- "Makefile", line 89: Missing dependency operator
- "Makefile", line 91: Need an operator
- "Makefile", line 92: Need an operator
- "Makefile", line 93: Missing dependency operator
- "Makefile", line 94: Missing dependency operator
- Error expanding embedded variable.
解决办法:用"gmake"编译就OK了。
本日志由 Admin 于 2011-03-02 18:32:10 发表到 Linux/Unix 中,目前已经被浏览 1121 次,评论 27 次;
MongoDB是C++开发的一款开源、无模式的文档型数据库,具有高性能、易部署、易使用、数据存储方便等特点;MongoDB采用Bson(binary json)的形式存储数据,无锁,无事务,有索引,支持集群和分片功,可动态增删结点。
实验环境:
系统:FreeBSD 8.1-RELEASE
版本:mongodb v1.6.6
安装:
目前,官网上并没有FreeBSD下MongoDB的pkg包下载,所以FreeBSD下MongoDB的安装方式只有两种:ports方式和源码方式。其中Ports方式十分简单,但是由于网速等因数影响,可能要很久才能完成安装;而在MongoDB依赖包安装不全的的情况下,使用源码方式安装MongoDB相对会更为复杂。
1. Ports方式安装MongoDB:
- cd /usr/ports/databases/mongodb
- make
- make install
Ports方式安装MongoDB十分简单,就以上三条命令。但由于网络问题或Ports树太旧等原因可能会报错。如出现错误终止,请仔细观察错误代码,删除/usr/ports/distfiles/下未下载完成的文件或更新Ports树后重新Make。
如果你有多台FreeBSD主机要安装MongoDB,而且这些主机的硬件平台几乎相同,为了提高工作效率,你可以将Ports方式安装的MongoDB、以及MongoDB的依赖包,打包成pkg包,然后通过scp方式复制到其他主机上使用pkg_add命令安,效率会成倍的提高。具体打包方式如下:
- cd /var/db/pkg
- pkg_create -R -b mongodb-1.* # 把*号换成版本号,-R参数为连同依赖包一起打包
- ls *.tbz # 查看打好的包
按以上方式打好包后,即可以拷贝到其他主机上,使用pkg_add mongodb-1.*.tbz进行安装。
2. 源码的方式安装:
①. 下载MongoDB:
打开www.mongodb.org/downloads页面,在最后一列找到你要需要版本的源码(我这里是v1.6.6),然后执行下列命令:
- #安装依赖包
- cd /usr/ports/lang/spidermonkey && make && make install
- cd /usr/ports/devel/scons && make && make install #在弹出的窗口中选上"python"
- cd /usr/ports/devel/boost-all && make && make install
- cd /usr/ports/devel/libexecinfo && make && make install
- cd /usr/ports/devel/pcre && make && make install #官方的文档中没此项,会报错
- #下载,解压,编译
- cd /usr/local
- fetch http://downloads.mongodb.org/src/mongodb-src-r1.6.5.tar.gz
- tar -zxvf mongodb-src-r1.6.5.tar.gz
- mv mongodb-src-r1.6.5 mongodb-1.6.5
- cd mongodb-1.6.5
- scons . # 然后等待完成
- # 设置环境变量
- export PATH=$PATH:/usr/local/mongodb-1.6.5
启动MongoDB服务:
MongoDB的服务端运行模式有三种,分别是:单台模式、主从模式、分片模式。
1. 单台模式的Mongodb的启动:
- mkdir -p /data/db
- mongod --dbpath /data/db --logpath /data/db/db.log --fork
- # 查看状态
- mongo 127.0.0.1:27017
- show dbs #显示数据库
- help
2. 主从(Master、Slave)模式的Mongodb的启动:
Master主机( ip为10.0.0.1):
- mongod --master --dbpath /data/master --logpath /data/master/master.log --fork
- cat /data/master/master.log
Slave主机(ip为10.0.0.2):
- mongod --slave --dbpath /data/slave --logpath /data/slave/slave.log --source 10.0.0.1:27017 --fork
- cat /data/slave/slave.log
测试:
- # 查看状态
- mongo 10.0.0.1:27017
- show dbs #显示数据库
- help
3. 分片模式:
由于分片模式配置相对复杂,在另篇文章详细介绍。
相关网站:
1. MongoDB下载:www.mongodb.org/downloads
2. 各种平台的安装帮助: http://www.mongodb.org/display/DOCS/BUILDING
3. 他们在使用MongoDB: http://www.mongodb.org/display/DOCS/Production+Deployments
4. 开发驱动:http://www.mongodb.org/display/DOCS/Drivers
Excellent site, keep up the good work my colleagues would lo
Church Christian louboutin pumps Yves Saint Laurent Pumps
[url=http://www.redroselady.com]shoes tory burch[/url]
<a title="Christian Louboutin Sandals" href="http://www.mygi
coach outlet has become necessary in everyday life of women
彩虹表好大 ,我下了个700M的,破解出来的密码是错的。
This site is amazing. I consistently come across something n
you are right
thanks for your submit
© Copy 2010 Aiezu.Com. All rights reserved. Powered by Aiezu.com.