1.nginx反向代理服务器俗称"动静分离" (我这里简单安装一下)
第一步 :安装Apache
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.25.tar.bz2
tar jxf httpd-2.4.25.tar.bz2
cd httpd-2.4.25
./configure --prefix=/usr/local/apache -enable-so --enable-proxy -enable-rewrite \
-with-mpm-worker --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
make && make install
解决编译apache出现的问题:configure: error: APR not found . Please read the documentation
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
解决apr not found问题
tar -zxf apr-1.4.5.tar.gz
cd apr-1.4.5
./configure --prefix=/usr/local/apr
make && make install
解决APR-util not found问题
tar -zxf apr-util-1.3.12.tar.gz
cd apr-util-1.3.12
./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
make && make install
解决pcre问题
unzip -o pcre-8.10.zip
cd pcre-8.10
./configure --prefix=/usr/local/pcre
安装成功Apache之后启动 /usr/local/apache/bin/apachectl start (访问你的ip)出现下面就OK
It Works
第二步:安装php
yum install gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel
wget http://cn2.php.net/get/php-5.6.29.tar.gz/from/this/mirror
tar zxf php-5.6.29.tar.gz
cd php-5.6.29
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs \
--with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --enable-mbregex \
--enable-bcmath --enable-mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --enable-mbstring=all
make && make install
cp php.ini-development /usr/local/php/lib/php.ini (复制php.ini的配置文件)
vim /usr/local/apache/conf/httpd.conf
配置Apache的文件,在主配置文件
AddType application/x-httpd-php .php (让Apache解析php文件)
/usr/local/apache/bin/apachectl restart (重启Apache)
vim /usr/local/apache/htdocs/index.php (写点php代码看看是否解析 不行的话自行百度)
第三部:安装nginx(把端口该为8080)
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar zxf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/src/nginx --with-pcre=/usr/local/ngingxpcre (检测配置)
make && make install
出现pcre错误解决如下
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
tar jxf pcre-8.39.tar.bz2
mv pcre-8.39.tar.bz2 /usr/local/nginxpcre
安装完成之后修改nginx的配置文件
vim /usr/local/nginx/conf/nginx.conf
修改如下代码(把原来的80端口改为8080)
/usr/local/nginx/sbin/nginx 这样就OK
自己测试一下 编辑一下index.php
vim /usr/local/apache/htdocs/index.php
比如:
phpinfo();
?>
进入你nginx中html目录随便上传一张图片 名字要对应主啊
访问你的ip如 192.168.1.71:8080/index.php (记住你现在已经把nginx的端口改为8080了)
出现图片与phpinfo相关的内容 说明你已经成功了 不懂@我