本次部署系统版本:
Redhat Enterprise 6 http://www.redhat.com/ 需要的软件包
(可能还需要其他依赖软件包,rpm安装即可)
mysql-5.0.56.tar.gz nginx-1.2.0.tar.gz php-5.3.10.tar.gz 为什么要选择使用nginx?
Nginx (\是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个 公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。2011年6月1日,nginx 1.0.4发布。 http://nginx.org/ 从http://nginx.org/下载软件包,最好不要选择最新的版本。 Tar && ./configure && make && make install [root@localhost nginx-1.2.0]# groupaddnginx [root@localhost nginx-1.2.0]# useradd -s /sbin/nologin -M -g nginxnginx [root@localhost ~]# tar zxvf nginx-1.2.0.tar.gz [root@localhost ~]# cd nginx-1.2.0 [root@localhost nginx-1.2.0]# ./configure --prefix=/usr/local/nginx --user=nginx--group=nginx --with-http_stub_status_module --with-http_ssl_module(会有一系列的依赖关系解决方法下面) --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module [root@localhost nginx-1.2.0]# make && make install [root@localhost nginx-1.2.0]# /usr/local/nginx/sbin/nginx(开启服务) [root@localhost nginx-1.2.0]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT Nginx web 就可以正常访问了 指定安装 目录 指定用户身份 指定组身份 启用https支持 Error
? ./configure: error: C compiler gcc is not found
[root@localhost nginx-1.2.0]# yum -y install gccgcc-c++
? ./configure: error: the HTTP rewrite module requires the PCRE library.
[root@localhost nginx-1.2.0]# yum -y install pcrepcre-devel ? ./configure: error: SSL modules require the OpenSSL library.
[root@localhost nginx-1.2.0]# yum -y install opensslopenssl-devel
作为一个动态网站开发使用, nginx自身是做不到的, 数据库我们选择用 mysql
[root@localhost ~]# useradd -s /sbin/nologin -M mysql [root@localhost ~]# tar zxvf mysql-5.0.56.tar.gz [root@localhost ~]# cd mysql-5.0.56 [root@localhost mysql-5.0.56]# ./configure --prefix=/usr/local/mysql [root@localhost mysql-5.0.56]# make && make install 安装后配置 [root@localhost mysql-5.0.56]#cp support-files/my-medium.cnf /etc/my.cnf [root@localhostmysql-5.0.56]#/usr/local/mysql/bin/mysql_install_db --user=mysql [root@localhost mysql-5.0.56]# chown -R root:mysql /usr/local/mysql/ [root@localhost mysql-5.0.56]#chown -R mysql /usr/local/mysql/var/ [root@localhost /etc/ld.so.Conf mysql-5.0.56]# echo \>> [root@localhost mysql-5.0.56]# ldconfig [root@localhost mysql-5.0.56]# cp support-files/mysql.server /etc/init.d/mysqld [root@localhost mysql-5.0.56]# chmod +x /etc/init.d/mysqld [root@localhost mysql-5.0.56]# chkconfig --add mysqld [root@localhost mysql-5.0.56]# chkconfigmysqld on [root@localhost mysql-5.0.56]# chkconfig --level 35 mysqld on [root@localhost mysql-5.0.56]# service mysqld start Starting MySQL. SUCCESS! [root@localhost mysql-5.0.56]# echo $PATH:/usr/local/mysql/bin/ 测试 [root@localhost mysql-5.0.56]# /usr/local/mysql/bin/mysql -u root -p Enter password: #输入密码 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> Error
? configure: error: No curses/termcap library found
[root@localhost mysql-5.0.56]# yum -y install libtermcap-devel ncurses-devel.x86_64 0:5.7-3.20090208.el6 PHP环境
[root@localhost php-5.3.10]# tar zxvf php-5.3.10.tar.gz [root@localhost --enable-mbs tring --enable-fastcgi --enable-debug --with-mysql=/usr/local/mysql/ [root@localhost php-5.3.10]# cd php-5.3.10 --prefix=/usr/local/php5 --enable-mbstring --enable-fastcgi --with-mysql=/usr/local/mysql/ 指定安装位置 开启多字符支持 启用fastcgi接口 用于和nginx关联 关联数据库 php-5.3.10]# ./configure --prefix=/usr/local/php5 [root@localhost php-5.3.10]# make && make install [root@localhost php-5.3.10]# cp php.ini-production /usr/local/php5/php.ini(配置文件) [root@localhost bin]# /usr/local/php5/bin/php-cgi -b 5566 指定端口 修改nginx配置文件 把下面字段注释去掉,然后修改端口为5566 location ~ \\.php$ {