http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 安装mysql
rpm -qa | grep mysql // 这个命令就会查看该操作系统上是否已经安装了mysql数据库
rpm -e --nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
yum install -y mysql-server mysql mysql-deve
service mysqld start
service mysqld restart
mysqladmin -u root password ‘root‘ // 通过该命令给root账号设置密码为 root
此时我们就可以通过 mysql -u root -p 命令来登录我们的mysql数据库了
二 安装apache
yum install -y gcc gcc-c++
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2.编译安装:yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
具体步骤如下: a:解决apr not found问题>>>>>>
[[email protected] test]# tar -zxf apr-1.4.5.tar.gz
[[email protected] test]# cd apr-1.4.5
[[email protected] apr-1.4.5]# ./configure --prefix=/usr/local/apr
[[email protected] apr-1.4.5]# make && make install
b:解决APR-util not found问题>>>>
[[email protected] test]# tar -zxf apr-util-1.3.12.tar.gz
[[email protected] test]# cd apr-util-1.3.12
[[email protected] apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[[email protected] apr-util-1.3.12]# make && make install
c:解决pcre问题>>>>>>>>>
[[email protected] test]#unzip -o pcre-8.10.zip
[[email protected] test]#cd pcre-8.10
[[email protected] pcre-8.10]#./configure --prefix=/usr/local/pcre
[[email protected] pcre-8.10]#make && make install
wget http://apache.fayea.com//httpd/httpd-2.4.10.tar.gz
执行命令 tar -zxvf httpd-2.4.10.tar.gz,解压缩后会生成httpd-2.4.10目录
cd httpd-2.4.10 进入httpd-2.4.10目录,搜寻设定内容,执行:
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi
make
make install
/usr/local/apache/bin/apachectl start 开启
修改端口号 listen 81
ServerName localhost:81
三 PHP
1: wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar -zxvf libiconv-1.13.1.tar.gz cd libiconv-1.13.1 ./configure --prefix=/usr/local/libiconv
make
make install
configure error xml2-config not found. please check your libxml2 installation
yum install libxml2
yum install libxml2-devel -y
[[email protected] /] # find / -name "xml2-config"
/usr/bin/xml2-config
如果安装成功以后,在/usr/local/libxml2/目录下将生成bin、include、lib、man和share五个目录。在后面安装PHP5源代码包的配置时,会通过在configure命令的选项中加上"--with-libxml-dir=/usr/ local/libxml2"选项,用于指定安装libxml2库文件的位置。
undefined reference to `libiconv_open 无法编译PHP libiconv
解决方法: #wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz #tar -zxvf libiconv-1.13.1.tar.gz #cd libiconv-1.13.1 # ./configure --prefix=/usr/local/libiconv # make # make install
加上一下这句
--with-iconv=/usr/local/libiconv
wget http://cn2.php.net/distributions/php-5.5.20.tar.gz
tar zvxf php-5.5.20.tar.gzcd php-5.5.20
./configure --prefix=/usr/local/php --disable-fileinfo --enable-maintainer-zts --with-apxs2=/usr/local/apache/bin/apxs --with-iconv=/usr/local/libiconv --with-config-file-path=/usr/local/php/etc
make make install
4.重新配置apache2让他支持php
- 配置 httpd.conf 让apache支持PHP:
# vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php (.前面有空格)
AddType application/x-httpd-php-source .phps (.前面有空格)
在LoadModule php5_module modules/libphp5.so这一行下面添加: AddType application/x-httpd-php .php (注意:php .php这个点前面有一个空格)
找到:;open_basedir =
修改为:open_basedir = .:/tmp/ #防止php木马跨站
找到:;date.timezone =
修改为:date.timezone = PRC
- 然后CPOPY PHP的配置文件
cp php-5.3.8/php.ini.dist /usr/local/php/etc/php.ini
(如果没有php.ini.dist 则把php.ini-development php.ini-production中的任何一个重命名为php.ini.dist即可。)
修改php.ini文件 register_globals = On
4: NGINX
yum install libtool yum install zlib zlib-devel
yum install openssl
configure: error: You need a C++ compiler for C++ support. (解决办法: yum install -y gcc gcc-c++)
http://chenzhou123520.iteye.com/blog/1817563 [pcre]安装
http://nginx.org/ 下载nginx
wget http://nginx.org/download/nginx-1.0.1.tar.gz
tar zxvf nginx-1.0.1.tar.gz
cd nginx-1.0.1/
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre=这里是pcre的源代码目录 ,不是安装目录
make && make install
nginx的启动命令是:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
# /usr/local/nginx/sbin/nginx -s reload
nginx已经重启成功
配置 :
location / {
root /usr/local/apache/htdocs;
index index.html index.htm;
}
location ~ \.php$ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:81;
}
location ~.*\.(jpg|jepg|png)$ {
root /usr/local/apache/htdocs;
access_log off;
expires 3d;
}
location ~.*\.(js|css)$ {
root /usr/local/apache/htdocs;
access_log off;
expires 3d;
}