文章标签 ‘apache’
转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/useful_apache_urlrewrite/
# 将domain.com/xxx转向www.domain.com/xxx
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,NC]
# 将xxx.domain.com/yyy...重定向到www.domain.com/xxx/yyy..., xxx 5-20位, 字母开头只含字母, 数字以及"-"和"_"
RewriteCond %{SERVER_NAME} ^([a-z][a-z0-9\-\_]{4,19})\.domain\.com [NC]
RewriteRule ^(.+)$ %{SERVER_NAME}$1 [C]
RewriteRule ^([a-z][a-z0-9\-\_]{4,19})\.domain\.com(.*)$ http://www.domain.com/$1$2 [R=301,NC]
# 将首页www.domain.com转向www.domain.com/html/index.html
RewriteCond %{HTTP_HOST} www\.domain\.com
RewriteRule ^/$ http://www.domain.com/html/index.html [R=301,L]
-- EOF --
转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/configure_lamp/
编译环境
Debian (Ubuntu)
apt-get install build-essential
apt-get install libncurses5-dev
sudo apt-get install libxml2-dev libcurl3-dev libpng-dev libmhash-dev libmcrypt-dev libxslt-dev libpspell-dev
Mysql编译安装参数
CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" CXXFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Community-Server --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-ndb-debug --without-isam --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
配置成功会提示:
MySQL has [...]
转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/htaccess_error_on_apache/
使用了apache的 .htaccess做身份认证后, 无法访问
查看日志报错如下:
"Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration"
LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so
LoadModule authz_owner_module /usr/lib/apache2/modules/mod_authz_owner.so
LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so
ok,问题解决
-- EOF --
转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/close_timewait_connection/
结合netstat和awk命令来统计网络连接数
From: http://hi.baidu.com/thinkinginlamp/blog/item/afbcab64b1ad81f3f6365453.html
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
会得到类似下面的结果,具体数字会有所不同:
LAST_ACK 1
SYN_RECV 14
ESTABLISHED 79
FIN_WAIT1 28
FIN_WAIT2 3
CLOSING [...]
转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/apache2x_name_based_virtual_hosting/
NameVirtualHost *:80
<VirtualHost *:80>
ServerName a.lostk.com
DocumentRoot e:/webserver/htdocs/a
ErrorLog e:/webserver/apache/logs/a.lost-error.log
CustomLog e:/webserver/apache/logs/a.lost-access.log common
<Directory "e:/webserver/htdocs/a">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
[...]
