日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux中安装httpd安装错误,linux安装httpd和nginx常见问题及解决办法

發布時間:2024/10/8 linux 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux中安装httpd安装错误,linux安装httpd和nginx常见问题及解决办法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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

http://mirrors.tuna.tsinghua.edu.cn/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

http://mirrors.tuna.tsinghua.edu.cn/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 install

1.4

pcre

wget

http://ftp.exim.llorien.org/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

cd httpd-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 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

http://ftp.exim.llorien.org/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

則執行:sudo apt-get install build-essential

(build-essential 是一整套工具,gcc,libc等等)

或者:sudo apt-get install make gcc

g++再裝上函數手冊:sudo apt-get install manpages-dev

注:如是redhat或centos,則執行:yum install -y gcc gcc-c++

3.3

Nginx

3.3.1

Nginx1.10.1啟動報錯

nginx: [alert] could not open error log file:

open() "/usr/local/nginx/logs/error.log" failed (13:Permission

denied)

2014/08/04 20:35:45 [emerg] 17114#0: open()

"/usr/local/nginx/logs/access.log" failed (13: Permission

denied)

原因分析:當前用戶對該位置沒有寫入權限

解決辦法,執行命令:

1、sudo /usr/local/nginx/sbin/nginx -c

/usr/local/nginx/conf/nginx.conf 以root權限啟動

2、sudo chmod -R a+rw /usr/local/nginx

給所有用戶賦權限(個人學習,不考慮安全問題)

3、啟動Nginx :/usr/local/nginx/sbin/nginx -c

/usr/local/nginx/conf/nginx.conf

注:以非root權限啟動時,會出現nginx: [emerg] bind() to 0.0.0.0:80 failed (13:

Permission denied) 錯誤

原因:Linux只有root用戶可以使用1024一下的端口

解決辦法:1.已root權限啟動

2.將/usr/local/nginx/conf/nginx.conf

文件中的80端口改為1024以上

server {

#?listen 80

listen

8080

}

3.3.2

nginx1.10.1啟動失敗

端口被占用

: [emerg] bind() to 0.0.0.0:80 failed (98: Address

already in use)

總結

以上是生活随笔為你收集整理的linux中安装httpd安装错误,linux安装httpd和nginx常见问题及解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。