2010
03.02

程序版本为: Nginx 0.7.60  PHP5.2.9  MySQL 5.1.35

1.首先登陆VPS,用SSH登陆.

2.安装LNMP,进入一个目录:cd /usr/local/src

然后就下载LNMP:wget http://imcat.in/LNMP.zip

解压缩 unzip LNMP.zip

有些VPS安装后没有unzip这个命令,那么运行 yum install unzip

进入该目录 cd LNMP

给脚本添加执行权限:chmod +x down.sh install.sh startup.sh

下载安装所需的源代码文件: ./down.sh

开始安装: ./install.sh

安装完后,请运行:passwd www

为www用户设置一个密码.这个用户和密码就是ftp的用户名和密码

修改您的MySQL的root密码
使用命令:mysqladmin -u root -p password mypasswd //mypasswd为自己的密码
如果提示没有mysqladmin命令.请运行:yum install mysql

这样你就可以上传你的网站了.

程序安装路径:
MySQL : /usr/local/mysql
PHP : /usr/local/php
Nginx : /usr/local/nginx
PHPMyAdmin /home/www/phpmyadmin
Web目录 /home/www
FTP根目录 /home/www

注意:MYSQL数据库用户名root密码root,登陆后进入mysql数据库,找到user表,删除除了有root密码外的所有用户。

另外:Linux系统要用32位的.64位占用的内存很大的.

17 comments | 1,336 views
2010
02.27

apt-get install libxml2-dev libmcrypt-dev libssl-dev libldap2-dev libmhash-dev libmysqlclient-dev libcurl4-openssl-dev libpng-dev libjpeg-dev libsasl2-dev
安装libevent

cd ~/src
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar xf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure –enable-shared
make
make install

ulimit -SHn 65535
安装pcre
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz
tar zxvf pcre-8.00.tar.gz
cd pcre-8.00/
./configure
make && make install

安装libunwind#否则无法安装Google-perftools
cd /libunwind-0.99
./configure –enableshared
make
make install

安装google-perftools#mysql和nginx需要(64位必须加–enable-frame-pointers)
wget http://google-perftools.googlecode.com/files/google-perftools-1.5.tar.gz
./configure –enableshared –enable-frame-pointers
make
make install

下载purge #清除缓存用的
wget http://labs.frickle.com/files/ngx_cache_purge-1.0.tar.gz
tar zxvf ngx_cache_purge-1.0.tar.gz

wget http://nginx.org/download/nginx-0.8.32.tar.gz
tar zxvf nginx-0.8.32.tar.gz
cd nginx-0.8.32/
cd ../
./configure –prefix=/zh/nginx –user=www-data –group=www-data –with-rtsig_module –with-select_module –with-poll_module –with-ipv6 –with-http_ssl_module –with-http_realip_module –with-http_sub_module –with-http_flv_module –with-http_gzip_static_module –with-http_stub_status_module –http-client-body-temp-path=/tmp/nginx/client –http-proxy-temp-path=/tmp/nginx/proxy –http-fastcgi-temp-path=/tmp/nginx/fastcgi –with-google_perftools_module –add-module=/home/web_package/ngx_cache_purge-1.0

启动nginx错误解决办法
1:error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
解决方法,在/lib中创建一个symbol link到/usr/local/pcre/lib/libpcre.so.0
sudo ln -s /usr/local/pcre/lib/libpcre.so.0 /lib
2:error while loading shared libraries: libprofiler.so.0: cannot open shared object file: No such file or directory

安装ImageMagick
cd ~/src
apt-get build-dep imagemagick
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xf ImageMagick.tar.gz
cd ImageMagick-6.5.8-6/
./configure
make
aptitude install libperl-dev
make install

apt-get build-dep php
wget http://cn2.php.net/get/php-5.3.1.tar.bz2/from/this/mirror
tar xf php-5.3.1.tar.bz2
#下载imagick

cd ~/src
wget http://pecl.php.net/get/imagick-2.3.0.tgz
tar xf imagick-2.3.0.tgz
cp -R imagick-2.3.0 php-5.3.1/ext/imagick
cd php-5.3.1
./buildconf –force
#下载php-fpm

apt-get install batch
wget http://launchpad.net/php-fpm/master/0.6/+download/php-fpm-0.6~5.3.1.tar.gz
$ tar -xzf php-fpm-0.6~5.3.1.tar.gz
$ php-fpm-0.6-5.3.1/generate-fpm-patch
$ bzip2 -cd php-5.3.1.tar.bz2 | tar xf -
$ patch -d php-5.3.1 -p1 $ cd php-5.3.1
$ ./buildconf –force

./configure –prefix=/zh/php5 –with-fpm –with-libxml-dir=/usr –with-fpm-bin=/zh/php5/fpm –with-fpm-conf=/zh/php5/etc –with-fpm-user=www-data –with-fpm-group=ww-data –with-layout=GUN –with-config-file-path=/zh/php5/etc –with-config-file-scan-dir=/zh/php5/etc –with-openssl –with-zlib –enable-bcmath –enable-calendar –with-curl –with-curlwrappers –enable-exif –enable-ftp –disable-rpath –with-gd –with-jpeg-dir –with-png-dir –enable-gd-native-ttf –with-gettext –with-mhash –with-imagick –with-imap –with-imap-ssl –with-ldap –enable-mbstring –with-mcrypt –with-mysql=mysqlnd –enable-mbregex –with-mysql-sock –with-mysqli –with-pdo-mysql –with-pdo-sqlite –enable-soap –enable-sockets –enable-sqlite-utf8 –enable-sysvsem –with-xmlrpc –enable-zip –without-pear –enable-shmop –enable-pcntl –with-libevent=shared –with-kerberos

make
make install

安装记录

molyx:/home/web_package/php-5.3.1# make install
Installing PHP SAPI module:       fpm
Installing PHP CLI binary:        /zh/php5/bin/
Installing PHP CLI man page:      /zh/php5/man/man1/
Installing build environment:     /zh/php5/lib/php/build/
Installing header files:          /zh/php5/include/php/
Installing helper programs:       /zh/php5/bin/
  program: phpize
  program: php-config
Installing man pages:             /zh/php5/man/man1/
  page: phpize.1
  page: php-config.1
/home/web_package/php-5.3.1/build/shtool install -c ext/phar/phar.phar /zh/php5/bin
ln -s -f /zh/php5/bin/phar.phar /zh/php5/bin/phar

update-rc.d php-fpm defaults
sed -i “s/nobody/www-data/g” /etc/php-fpm.conf
/etc/init.d/php-fpm start

make install
cp php.ini-dist /opt/php/lib/php.ini
ln -s /opt/php/sbin/php-fpm /etc/init.d/php-fpm
update-rc.d -f php-fpm defaults

编译后的php安装在/opt/php下面,php的配置文件是/opt/php/lib/php.ini

和其他Linux下不同,在Debian下这时候启动php-fpm会失败,原因是在Debian下php-fpm的配置文件中必须指定运行时的用户才行。
优化php-fpm

编辑php-fpm的配置文件/opt/php/etc/php-fpm.conf,

* 去掉display_errors参数的注释,修改参数值为1
* 去掉sendmail_path参数的注释
* 去掉user,group参数的注释
* 修改max_children参数的值为10

安装php加速器eAccelerator

tar jxf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
apt-get install -y autoconf
/opt/php/bin/phpize
./configure –enable-eaccelerator –with-php-config=/opt/php/bin/php-config
make install
mkdir /opt/php/eaccelerator_cache

然后vim /opt/php/lib/php.ini,在文件末尾加入:

[eaccelerator]
zend_extension=”/opt/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/opt/php/eaccelerator_cache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

然后重启php-fpm,在phpinfo()页面中应该能看到eaccelerator的信息了。

错误解决
1:utf8_mime2text() has new signature, but U8T_CANONICAL is missing
安装c-client
apt-get install libc-client-dev
2:configure: error: libevent.a could not be found. Stop.
使用参数–with-libevent=shared
3:This c-client library is built with Kerberos support.
添加 –with-kerberos to your configure line. Check config.log for details

1 comment | 1,767 views
2010
02.11

大了之后我们是不是总是觉得自己很孤独

我们越想着自己的孤独就越想着别人的幸福

其实我们不孤独的

只是一个必要的经历阶段罢了

大了小时候的玩伴必然会为了自己的理想而各自去奋斗

因为我们已经不是处在那样的一个可以整天肆意妄为的无忧无虑的整天玩的年纪了

让自己充实一些 其实仔细想想我们可以做的事情很多的

只要我们的生活充实了 你也就不会感觉到孤独了

希望这些道理你可以明白

                                                                                                                       To   LONLY、

2 comments | 653 views
2010
02.06

这两天 只要服务器在线人数一高就会出现500错误  查了下资料

发现估计是连接数  限制  就找到了下面的配置文件  记录下  以后可以用到…

# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.2 2009/05/08 22:59:37 root Exp $

############ Options you really have to take care of ####################

## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# – saves some time
# – saves memory
server.modules              = (
                               “mod_rewrite”,
                               “mod_redirect”,
                               “mod_alias”,
                                “mod_access”,
#                               “mod_cml”,
#                               “mod_trigger_b4_dl”,
                               “mod_auth”,
                               “mod_status”,
                               “mod_setenv”,
                               “mod_fastcgi”,
                               “mod_webdav”,
#                               “mod_proxy_core”,
#                               “mod_proxy_backend_http”,
#                               “mod_proxy_backend_fastcgi”,
#                               “mod_proxy_backend_scgi”,
#                               “mod_proxy_backend_ajp13″,
                               “mod_simple_vhost”,
                               “mod_evhost”,
                               “mod_userdir”,
                               “mod_cgi”,
                               “mod_compress”,
                               “mod_ssi”,
#                               “mod_usertrack”,
#                               “mod_expire”,
#                               “mod_secdownload”,
#                               “mod_rrdtool”,
                                “mod_accesslog” )

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = “/home/kloxo/httpd/default/”

## where to send error-messages to
server.errorlog             = “/home/kloxo/httpd/lighttpd/error.log”

# files to check for if …/ is requested
index-file.names            = (  “index.php”, “index.html”,
                                “index.htm”, “default.htm” )

## set the event-handler (read the performance section in the manual)
# server.event-handler = “freebsd-kqueue” # needed on OS X

#                               “mod_usertrack”,
#                               “mod_expire”,
#                               “mod_secdownload”,
#                               “mod_rrdtool”,
                                “mod_accesslog” )

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = “/home/kloxo/httpd/default/”

## where to send error-messages to
server.errorlog             = “/home/kloxo/httpd/lighttpd/error.log”

# files to check for if …/ is requested
index-file.names            = (  “index.php”, “index.html”,
                                “index.htm”, “default.htm” )

## set the event-handler (read the performance section in the manual)
# server.event-handler = “freebsd-kqueue” # needed on OS X

# mimetype mapping
mimetype.assign             = (
  “.pdf”          =>      “application/pdf”,
  “.sig”          =>      “application/pgp-signature”,
  “.spl”          =>      “application/futuresplash”,
  “.class”        =>      “application/octet-stream”,
  “.ps”           =>      “application/postscript”,
  “.torrent”      =>      “application/x-bittorrent”,
  “.dvi”          =>      “application/x-dvi”,
  “.gz”           =>      “application/x-gzip”,
  “.pac”          =>      “application/x-ns-proxy-autoconfig”,
  “.swf”          =>      “application/x-shockwave-flash”,
  “.tar.gz”       =>      “application/x-tgz”,
  “.tgz”          =>      “application/x-tgz”,
  “.tar”          =>      “application/x-tar”,
  “.zip”          =>      “application/zip”,
  “.mp3″          =>      “audio/mpeg”,
  “.m3u”          =>      “audio/x-mpegurl”,
  “.wma”          =>      “audio/x-ms-wma”,
  “.wax”          =>      “audio/x-ms-wax”,
  “.ogg”          =>      “application/ogg”,
  “.wav”          =>      “audio/x-wav”,
  “.gif”          =>      “image/gif”,
  “.jpg”          =>      “image/jpeg”,
  “.jpeg”         =>      “image/jpeg”,
  “.png”          =>      “image/png”,
  “.xbm”          =>      “image/x-xbitmap”,
  “.xpm”          =>      “image/x-xpixmap”,
  “.xwd”          =>      “image/x-xwindowdump”,
  “.css”          =>      “text/css”,
  “.html”         =>      “text/html”,
  “.htm”          =>      “text/html”,
  “.js”           =>      “text/javascript”,
  “.asc”          =>      “text/plain”,
  “.c”            =>      “text/plain”,
  “.cpp”          =>      “text/plain”,
  “.log”          =>      “text/plain”,
  “.conf”         =>      “text/plain”,
  “.text”         =>      “text/plain”,
  “.txt”          =>      “text/plain”,
  “.dtd”          =>      “text/xml”,
  “.xml”          =>      “text/xml”,
  “.mpeg”         =>      “video/mpeg”,
  “.mpg”          =>      “video/mpeg”,
  “.mov”          =>      “video/quicktime”,
  “.qt”           =>      “video/quicktime”,
  “.avi”          =>      “video/x-msvideo”,
  “.asf”          =>      “video/x-ms-asf”,
  “.asx”          =>      “video/x-ms-asf”,
  “.wmv”          =>      “video/x-ms-wmv”,
  “.bz2″          =>      “application/x-bzip”,
  “.tbz”          =>      “application/x-bzip-compressed-tar”,
  “.tar.bz2″      =>      “application/x-bzip-compressed-tar”
 )

# Use the “Content-Type” extended attribute to obtain mime type if possible
#mimetype.use-xattr        = “enable”
## send a different Server: header
## be nice and keep it at lighttpd
# server.tag                 = “lighttpd”

#### accesslog module
accesslog.filename          = “/home/kloxo/httpd/lighttpd/ligh.log”

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, …
# .inc is often used for code includes which should in general not be part
#      of the document-root
url.access-deny             = ( “~”, “.inc” )

$HTTP["url"] =~ “\.pdf$” {
  server.range-requests = “disable”
}

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( “.php”, “.pl”, “.fcgi” )

######### Options that are good to be but not neccesary to be changed #######

## bind to port (default: 80)
#server.port                = 81

## bind to localhost (default: all interfaces)
#server.bind                = “localhost”

## error-handler for status 404
#server.error-handler-404   = “/error-handler.html”
#server.error-handler-404   = “/error-handler.php”

## to help the rc.scripts
#server.pid-file            = “/var/run/lighttpd.pid”
###### virtual hosts
##
##  If you want name-based virtual hosting add the next three settings and load
##  mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root   = “/home/weigon/wwwroot/servers/”
#simple-vhost.default-host  = “grisu.home.kneschke.de”
#simple-vhost.document-root = “/pages/”
##
## Format: <errorfile-prefix><status-code>.html
## -> …./status-404.html for ‘File not found’
#server.errorfile-prefix    = “/home/weigon/projects/lighttpd/doc/status-”

## virtual directory listings
#dir-listing.activate       = “enable”

## enable debugging
#debug.log-request-header     = “enable”
#debug.log-response-header    = “enable”
#debug.log-request-handling   = “enable”
#debug.log-file-not-found     = “enable”
#debug.log-condition-handling = “enable”

### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot              = “/”

## change uid to <uid> (default: don’t care)
server.username            = “apache”

## change uid to <uid> (default: don’t care)
server.groupname           = “apache”

#### compress module
#compress.cache-dir         = “/tmp/lighttpd/cache/compress/”
#compress.filetype          = (“text/plain”, “text/html”)

#### proxy module
## read proxy.txt for more info
#$HTTP["url"] =~ “\.php$” {
#       proxy-core.balancer = “round-robin”
#       proxy-core.allow-x-sendfile = “enable”
#       proxy-core.protocol = “http”
#       proxy-core.backends = ( “192.168.0.101:80″ )
#       proxy-core.max-pool-size = 16
#}
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don’t forget to set cgi.fix_pathinfo = 1 in the php.ini
#$HTTP["url"] =~ “\.php$” {
#       proxy-core.balancer = “round-robin”
#       proxy-core.allow-x-sendfile = “enable”
#       proxy-core.check-local = “enable”
#       proxy-core.protocol = “fastcgi”
#       proxy-core.backends = ( “unix:/tmp/php-fastcgi.sock” )
#       proxy-core.max-pool-size = 16
#}
#### CGI module
#cgi.assign                 = ( “.php” => “/home/httpd/nobody.sh” )
#

#### SSL engine
#ssl.engine                 = “enable”
#ssl.pemfile                = “/etc/lighttpd/program.pem”

#### status module
#status.status-url          = “/server-status”
#status.config-url          = “/server-config”

#### auth module
## read authentication.txt for more info
#auth.backend               = “plain”
#auth.backend.plain.userfile = “lighttpd.user”
#auth.backend.plain.groupfile = “lighttpd.group”

#auth.backend.ldap.hostname = “localhost”
#auth.backend.ldap.base-dn  = “dc=my-domain,dc=com”
#auth.backend.ldap.filter   = “(uid=$)”

#auth.require               = ( “/server-status” =>
#                               (
#                                 “method”  => “digest”,
#                                 “realm”   => “download archiv”,
#                                 “require” => “user=jan”
#                               ),
#                               “/server-config” =>
#                               (
#                                 “method”  => “digest”,
#                                 “realm”   => “download archiv”,
#                                 “require” => “valid-user”
#                               )
#                             )

#### url handling modules (rewrite, redirect, access)
#url.rewrite                = ( “^/$”             => “/server-status” )
#url.redirect               = ( “^/wishlist/(.+)” => “http://www.123.org/$1” )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ “^www\.(.*)” {
#  url.redirect            = ( “^/(.*)” => “http://%1/$1” )
#}

#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern        = “/home/storage/dev/www/%3/htdocs/”

#### expire module
#expire.url                 = ( “/buggy/” => “access 2 hours”, “/asdhas/” => “access plus 1 seconds 2 minutes”)

#### ssi
ssi.extension              = ( “.shtml” )

#### rrdtool
#rrdtool.binary             = “/usr/bin/rrdtool”
#rrdtool.db-name            = “/var/www/lighttpd.rrd”

#### setenv
#setenv.add-request-header  = ( “TRAV_ENV” => “mysql://user@host/db” )
#setenv.add-response-header = ( “X-Secret-Message” => “42″ )

## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = “/home/weigon/testbase/trigger.db”
# trigger-before-download.memcache-hosts = ( “127.0.0.1:11211″ )
# trigger-before-download.trigger-url = “^/trigger/”
# trigger-before-download.download-url = “^/download/”
# trigger-before-download.deny-url = “http://127.0.0.1/index.html
# trigger-before-download.trigger-timeout = 10

## for mod_cml
## don’t forget to add index.cml to server.indexfiles
# cml.extension               = “.cml”
# cml.memcache-hosts          = ( “127.0.0.1:11211″ )

#### variable usage:
## variable name without “.” is auto prefixed by “var.” and becomes “var.bar”
#bar = 1
#var.mystring = “foo”

## integer add
#bar += 1
## string concat, with integer cast as string, result: “www.foo1.com
#server.name = “www.” + mystring + var.bar + “.com”
## array merge
#index-file.names = (foo + “.php”) + index-file.names
#index-file.names += (foo + “.php”)

#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: “lighttpd -f /etc/lighttpd/lighttpd.conf”
#include “lighttpd-inc.conf”

#### include_shell
#include_shell “echo var.a=1″
## the above is same as:
#var.a=1

userdir.path = “public_html”
alias.url = ( “/awstatsicons” => “/home/kloxo/httpd/awstats/wwwroot/icon/” )
alias.url += ( “/awstatscss” => “/home/kloxo/httpd/awstats/wwwroot/css/” )

include “local.lighttpd.conf”
include “conf/kloxo/kloxo.conf”

server.max-worker = 10

# max-connections == max-fds/2 (maybe /3)
server.max-connections = 1024
server.max-fds = 2048

#Maximum number of seconds until an idling keep-alive connection is dropped.
server.max-keep-alive-idle = 5
server.max-keep-alive-requests = 1000

0 comments | 1,759 views
2010
02.04

goodbye my friend

goodbye my lover

歌词很让人感动。。。

0 comments | 512 views

Switch to our mobile site