一、先装MySQL
$ tar xzvf mysql*.tar.gz
$ cd mysql*
$ ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
$ make
$ make install
$ useradd mysql
$ chmod +w /usr/local/mysql
$ chown -R mysql:mysql /usr/local/mysql/
$ /usr/local/mysql/bin/mysql_install_db --user=mysql
$ cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
$ ln -s /etc/init.d/mysqld /etc/rc2.d/Kmysqld
$ ln -s /etc/init.d/mysqld /etc/rc2.d/Smysqld
$ /etc/init.d/mysqld start
MySQL安装结束…
二、安装PHP5.28+PHP-FPM+eAccelebrater
安装依赖
1:安装zlib2
./configure --prefix=/usr/local/zlib
2:安装PNG
cp scripts/makefile.linux ./makefile
./configure --prefix=/usr/local/libpng
3:安装ttf
./configure --prefix=/usr/local/freetype
4:安装JPEG6
mkdir -pv /usr/local/libjpeg/{,bin,lib,include,man/man1,man1}
./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
5:安装 libxml2
./configure --prefix=/usr/local/libxml2
make;make install
cp xml2-config /usr/bin
6:安装 libmcrypt-2.5.7.tar.gz
./configure;make;make install
7:安装Fontconfig
export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
8:安装GD库
./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-fontconfig=/usr/local/fontconfig
为PHP打上fpm补丁并编译安装:
$ bzip2 -cd php-5.2.8.tar.bz2 | tar xf -
$ gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
$ cd php-5.2.8 && ./configure --prefix=/usr/local/php5 --enable-force-cgi-redirect --enable-fastcgi --with-gd --enable-trace-vars --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-gd-native-ttf --with-ttf --enable-gd-jis-conv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --with-libxml-dir=/usr/local/libxml2 --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets --enable-fpm
$ make all install
$ cp php.ini-dist /usr/local/php5
php-fpm 启动
/usr/local/php5/sbin/php-fpm start
php-fpm 重启
/usr/local/php5/sbin/php-fpm restart
安装eAccelebrater:
$ tar xzvf eAccelebrater*.tar.gz
$ /usr/local/php5/bin/phpize
$ ./configure --with-php-config=/usr/local/php5/bin/php-config
$ make
$ make install
修改php.ini,修改extension_dir = extension_dir = “/usr/local/php5/lib/php5/extensions/no-debug-non-zts-20060613/”
添加:
extension=eaccelerator.so
extension="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.log_file = "/var/log/httpd/eaccelerator_log"
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"
保存退出,重启PHP。
mkdir /var/log/httpd/;mkdir /tmp/eaccelerator
三、安装Nginx
先安装pcre
然后
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_perl_module
nginx重启脚本
chown -R nobody:nobody /var/www
kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
—-本人懒性大发 以下跳跃着说—
nginx配置
user nobody;
worker_processes 10;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 15;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
server {
listen 80;
server_name www.yuing.cn;
#charset koi8-r;
access_log logs/access.www.yuing.cn.log main;
error_log logs/error.www.yuing.cn.log error;
location / {
root /var/www/www.yuing.cn;
index index.php index.html index.htm;
include php_fcgi.conf;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
error_page 404 /404.html;
location = /404.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location ~ /stats{
stub_status on;
access_log on;
auth_basic "NginxStatus";
#auth_basic_user_file conf/htpasswd;
}
}
#main
server {
listen 80;
server_name imethan.com;
access_log logs/access.imethan.com.log main;
error_log logs/error.imethan.com.log error;
location / {
root /var/www/imethan.com;
index index.php index.html index.htm;
include php_fcgi.conf;
}
error_page 404 /404.html;
location = /404.html {
root html;
}
}
error_page 404 /404.html;
location = /404.html {
root html;
}
}
}