一款优秀的国产PHP MVC轻量级开发框架
系统:CentOS 6.3 64位
nginx版本:1.4.5
php版本:5.5.9
mysql版本:5.1.55
安装Mysql
#cd /usr/local/src/
通常情况下,我们把安装源放在 /usr/local/src/目录下
下载Mysql安装包
#wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.55-linux-x86_64-glibc23.tar.gz
解压
#tar -zxvf mysql-5.1.55-linux-x86_64-glibc23.tar.gz
把解压完的数据包移动到/usr/local/mysql/目录下
#mv mysql-5.1.55-linux-x86_64-glibc23 /usr/local/mysql
创建mysql用户
#useradd mysql
创建数据库存放目录
#mkdir /data/
#mkdir /data/mysql/
为新创建的mysql目录赋予mysql用户权限
#chown -R mysql:mysql /data/mysql/
初始化数据库
#cd /usr/local/mysql/
#./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
拷贝配置文件
拷贝哪个配置文件取决于mysql服务使用内存大小
64M使用my-small.cnf
128M使用my-medium.cnf
512M使用my-large.cnf
1G-2G使用my-huge.cnf
#cp support-files/my-large.cnf /etc/my.cnf
拷贝启动脚本文件并修改其属性
#cp support-files/mysql.server /etc/init.d/mysqld
#chmod 755 /etc/init.d/mysqld
修改启动脚本
#vi /etc/init.d/mysqld
修改项:
basedir=/usr/local/mysql
datadir=/data/mysql
把启动脚本加入系统服务项,并设定开机启动,启动mysql
#chkconfig --add mysqld
#chkconfig mysqld on
#service mysqld start
看到Starting MySQL. SUCCESS! ,便启动成功啦!# yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-libs krb5-devel krb5-server libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
yum能安装上大多数的包,但个别包是安装不上的,有可能找不到源文件。安装不上的包,可以手动编译安装。
进入Nginx目录
# cd /usr/local/src/nginx-1.4.5/
# ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/var/nginx.pid --lock-path=/usr/local/nginx/var/nginx.lock --http-client-body-temp-path=/dev/shm/nginx_temp/client_body --http-proxy-temp-path=/dev/shm/nginx_temp/proxy --http-fastcgi-temp-path=/dev/shm/nginx_temp/fastcgi --user=www --group=www --with-cpu-opt=pentium4F --without-select_module --without-poll_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_memcached_module --without-http_map_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-pcre=/usr/local/src/pcre-8.34
编译安装Nginx
# make && make install
# mkdir /dev/shm/nginx_temp
编写nginx的启动脚本,并加入系统服务
# vi /etc/init.d/nginx 写入以下内容:
#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/var/nginx.pid"
RETVAL=0
prog="Nginx"
start() {
echo -n $"Starting $prog: "
mkdir -p /dev/shm/nginx_temp
daemon $NGINX_SBIN -c $NGINX_CONF
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -TERM
rm -rf /dev/shm/nginx_temp
RETVAL=$?
echo
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
configtest(){
$NGINX_SBIN -c $NGINX_CONF -t
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
configtest)
configtest
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|configtest}"
RETVAL=1
esac
exit $RETVAL
保存后,更改/etc/init.d/nginx的权限
#chmod 755 /etc/init.d/nginx
加入自启动
#chkconfig --add nginx
#chkconfig nginx on
修改nginx配置文件G-framework是一款免费开源的,快速、简单的面向对象的轻量级PHP开发框架,遵循Apache2开源协议发布。
鼓励代码共享和尊重原作者的著作权,同样允许代码修改后,再作为开源或商业软件发布。
Copyright © 2014 - 2020 G-framework All Rights Reserved.
框架执行时间: 3.6毫秒 页面执行时间: 4.8毫秒