首先安装mysql
下载mysql-5.1.36
执行:grpadd mysql
执行:useradd mysql
执行:tar xvf mysql-5.1.36.tar.gz
执行:CFLAGS=”-O3″ CXX=gcc CXXFLAGS=”-O3 -felide-constructors -fno-exceptions -fno-rtti -fomit-frame-pointer -ffixed-ebp”
执行:./configure –prefix=/opt/mysql/ –without-debug –with-unix-socket-path=/tmp/mysql.sock –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static –enable-assembler –with-extra-charsets=gbk,gb2312,utf8 –with-pthread –enable-thread-safe-client
出现如下错误
checking for termcap functions library… configure: error: No curses/termcap libraryfound
执行yum -y install curses-devel解决
执行make后出现
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] 错误 127
make[1]: Leaving directory `/usr/local/src/mysql/mysql-5.1.32/mysys`
make: *** [all-recursive] 错误 1
执行:yum -y install gcc-c++解决
执行make && make install
复制配置文件cp ./support-files/mysql-small.cnf /etc/mysql.cnf
/opt/mysql/bin/mysql_install_db –basedir=/opt/mysql –datadir=/opt/data –user=mysql –skip-locking –port=3306 –socket=/tmp/mysql.sock
chown -R mysql.mysql /opt/data
根据情况修改/etc/mysql.cnf
/opt/mysql/bin/mysqld_safe –user=mysql &
安装php-3.0.0
首先
yum install libjpeg-devel等安装所需包
下载php
tar xvf php-5.3.0.tar.gz
下载php-fpm
然后gunzip -cd php-5.3.0-fpm-0.5.12-rc.diff.gz | patch -d php-5.3.0 -p1
./configure –prefix=/opt/php –enable-fpm –with-fpm-pid=/tmp/php-fpm.pid –with-fpm-log=/tmp/php-fpm.log –with-fpm-conf=/opt/php/etc/php-fpm.conf –with-zend-vm=GOTO –enable-cli –enable-inline-optimization –disable-threads –disable-rpath –disable-ipv6 –enable-mbstring –enable-mbregex –with-mysql=/opt/mysql –with-curl –with-curlwrappers –with-zlib –with-gd –with-jpeg-dir=/usr/lib –with-png-dir=/usr/lib –with-freetype-dir=/usr/lib –enable-gd-native-ttf –enable-soap –enable-sockets
make && make install
然后编辑/opt/php/etc/php-fpm.conf
然后执行/opt/php/sbin/php-fpm start启动fastCGI
安装nginx
./configure –user=www –group=www –prefix=/opt/nginx
make && make install
然后编辑
vim /opt/nginx/conf/fastcgi_params
增加 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
然后编辑/opt/nginx/conf/nginx.conf
内容大致如下
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
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 65;
gzip on;
server {
listen 80;
server_name 127.0.0.1;
index index.php;
root /opt/nginx/html;
#charset koi8-r;
#access_log logs/host.access.log main;
location ~ \.php$
{
include /opt/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME html/$fastcgi_script_name;
root html;
}
#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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass
#}
# 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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
然后运行/opt/nginx/sbin/nginx启动nginx