linux安装httpd和nginx常见问题及解决办法
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1 httpd-2.4.23.tar.gz安装
安装httpd之前,需要安装:gcc、apr、apr-util、pcre、zlib。
文件参考:D:\01soft\02测试\02悬镜管家\web服务\httpd安装环境1.1 前期准备
apt-get install lrzsz
apt-get install gcc
apt-get install build-essential
1.2 apr
wget /apache//apr/apr-1.5.2.tar.gz
tar zxvf apr-1.5.2.tar.gz
cd apr-1.5.2/
./configure
make
make install
1.3 apr-util
wget /apache//apr/apr-util-1.5.4.tar.gz tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4/
./configure --with-apr=/usr/local/apr
make
make install
1.4 pcre
wget /pcre/pcre-8.36.tar.gz
chmod 777 pcre-8.36.tar.gz
tar zxvf pcre-8.36.tar.gz
cd pcre-8.36/
./configure
(遇某一失败,则执行apt-get install build-essential)
make
make install
1.5 zlib
将安装包放在指定目录下
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
./configure
(遇某一失败,执行vim Makefile)
make
make install
1.6 httpd-
2.4.23
将安装包放在指定目录下
tar zxvf httpd-2.4.23.tar.gz
cdhttpd-2.4.23/
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-pcre=/usr/local/pcre/bin/pcre-config --with-zlib-1.2.3=/usr/local/zlib-1.2.3 --enable-so
make
make install
如./configure时出错提示E: Unable to locate package crypto,E: Unable to locate package libssl 则执行:
cp /usr/local/ssl/lib/libssl.so /usr/lib/
cp /usr/local/ssl/lib/libcrypto.so /usr/lib/
重新执行
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-pcre=/usr/local/pcre/bin/pcre-config --with-zlib-1.2.3=/usr/local/zlib-1.2.3 --enable-so
make
make install
1.7 启动
cd /usr/local/apache2/bin/
./httpd
如提示ServerName问题,则修改conf下的httpd.conf文件的ServerName
将/usr/local/apache2/conf下的httpd.conf中的:
#ServerName :80
改为:
ServerName localhost:80
2 Nginx1.11.5
安装nginx之前应先安装gcc g++、pcre-8.37、lib-1.2.8,
CentOS 和RedHat:yum install gcc gcc-c++
ubuntu :apt-get install gcc-c++
2.1 pcre
wget /pcre/pcre-8.36.tar.gz
chmod 777 pcre-8.36.tar.gz
tar zxvf pcre-8.36.tar.gz
cd pcre-8.36/
./configure
(遇某一失败,则执行apt-get install build-essential)
make
make install
2.2 zlib
将安装包放在指定目录下
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
./configure
(遇某一失败,执行vim Makefile)
make
make install
3 常见问题
3.1 yum
3.1.1 yum lock
则执行:
ctrl+z
rm –f /var/run/yum.pid
3.2 pcre
3.2.1 make出错
pcre-8.37 执行make失败提示:The program 'make' can be found in the following packages: 则执行:apt-get install build-essential
3.2.2 Configure出错
unbuntu下安装pcre-8.37 configure: error: You need a C++ compiler for C++ support