国产一级一区二区_segui88久久综合9999_97久久夜色精品国产_欧美色网一区二区

掃一掃
關(guān)注微信公眾號(hào)

Apache2+mod_ssl+php5完全安裝實(shí)錄
2007-10-22   網(wǎng)絡(luò)

環(huán)境:

  RedHat 9.0

  說明:

  使用$ 開頭的是普通用戶身份執(zhí)行的命令

  使用# 開頭的是root帳號(hào)執(zhí)行的命令

  第一步:安裝apache

  下載apache2: http://httpd.apache.org/download.cgi

  我需要mod_ssl的支持,和apache1不同的是,mod_ssl不在是單獨(dú)的模塊,而是放在apache發(fā)行包里面了,默認(rèn)是不啟用的,config的時(shí)候選擇上就可以了。

  我使用DSO方式編譯安裝apache,同時(shí)將全部模塊都編譯好,以方便后來可能的需要。只要編輯httpd.conf,在里面去掉不想要的模塊(注釋或者刪除對(duì)應(yīng)模塊的LoadModule行),就可以定制自己的apache咯。

  $ tar zxvf httpd-2.0.50.tar.gz

  $ ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl=shared --enable-mods-shared=all --with-ssl=/usr/local/ssl

  $ make

  $ su

  # make install

  Apache有兩種使用模塊的方法,其一是永久性包含進(jìn)核心;

  如果操作系統(tǒng)支持動(dòng)態(tài)共享對(duì)象(DSO),而且能為autoconf所檢測(cè),則模塊還可以被動(dòng)態(tài)編譯。

  DSO模塊的存儲(chǔ)是獨(dú)立與核心的,可以被核心使用由mod_so模塊提供的運(yùn)行時(shí)刻配置指令包含或排除。

  如果編譯中包含有任何動(dòng)態(tài)模塊,則mod_so模塊會(huì)被自動(dòng)包含進(jìn)核心。如果希望核心能夠裝載DSO,而不實(shí)際編譯任何動(dòng)態(tài)模塊,需要明確指定--enable-so。

  (http://kajaa.bbs.us/ApacheManual/install.html)

  第一次按照上述方法編譯的apache,啟動(dòng)的時(shí)候會(huì)報(bào)錯(cuò):

  # cd /usr/local/apache2

  # ./bin/apachectl startssl

  Syntax error on line 251 of /usr/local/apache/conf/httpd.conf:

  Cannot load /usr/local/apache/modules/mod_ssl.so into server: /usr/local/apache/modules/mod_ssl.so: undefined symbol: X509_free

  原因是什么呢?看 http://www.smartframeworks.com/qt-apache-ssl.html

  因?yàn)榘凑障旅娴姆椒ǎ▍⒖矗篈pache2 + mod_ssl + php5 完全安裝實(shí)錄(2))安裝的openssl默認(rèn)是沒有編譯成動(dòng)態(tài)鏈接庫(kù)的,因?yàn)槠湮臋n說openssl的動(dòng)態(tài)鏈接庫(kù)還不成熟,可以使用 ./config shared 編譯帶動(dòng)態(tài)鏈接庫(kù)的openssl,但是還處于試驗(yàn)階段。

  解決這個(gè)問題的辦法是:將mod_ssl靜態(tài)的編譯到apache里面。

  請(qǐng)使用下面的方法重新來過:)

  $ ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl=static --with-ssl=/usr/local/ssl --enable-mods-shared=all

  $ make

  $ su

  # make install

  這次啟動(dòng)apache的時(shí)候又發(fā)現(xiàn)一個(gè)錯(cuò)誤:

  # cd /usr/local/apache2

  # ./bin/apachectl startssl

  Syntax error on line 108 of /usr/local/apache2/conf/ssl.conf:

  SSLCertificateFile: file '/usr/local/apache2/conf/ssl.crt/server.crt' does not exist or is empty

  這又是什么原因呢?因?yàn)槲覀儧]有配置ssl,需要生成ssl需要的證書。

  以前使用apache1+mod_ssl的時(shí)候,make之后有一個(gè)這樣的步驟

  $ make certificate

  可以用來生成ssl所用到的證書。

  現(xiàn)在沒有這個(gè)工具了,只能自己動(dòng)手生成了,對(duì)證書不熟悉的人,有一個(gè)工具可以使用:http://www.openssl.org/contrib/ssl.ca-0.1.tar.gz

  # cd /usr/local/apache2/conf

  # tar zxvf ssl.ca-0.1.tar.gz

  # cd ssl.ca-0.1

  # ./new-root-ca.sh (生成根證書)

  No Root CA key round. Generating one

  Generating RSA private key, 1024 bit long modulus

  ...........................++++++

  ....++++++

  e is 65537 (0x10001)

  Enter pass phrase for ca.key: (輸入一個(gè)密碼)

  Verifying - Enter pass phrase for ca.key: (再輸入一次密碼)

  ......

  Self-sign the root CA... (簽署根證書)

  Enter pass phrase for ca.key: (輸入剛剛設(shè)置的密碼)

  ........

  ........ (下面開始簽署)

  Country Name (2 letter code) [MY]:CN

  State or Province Name (full name) [Perak]:JiangSu

  Locality Name (eg, city) [Sitiawan]:NanJing

  Organization Name (eg, company) [My Directory Sdn Bhd]:Wiscom System Co.,Ltd

  Organizational Unit Name (eg, section) [Certification Services Division]:ACSTAR

  Common Name (eg, MD Root CA) []:WISCOM CA

  Email Address []:acmail@wiscom.com.cn

  這樣就生成了ca.key和ca.crt兩個(gè)文件,下面還要為我們的服務(wù)器生成一個(gè)證書:

  # ./new-server-cert.sh server (這個(gè)證書的名字是server)

  ......

  ......

  Country Name (2 letter code) [MY]:CN

  State or Province Name (full name) [Perak]:JiangSu

  Locality Name (eg, city) [Sitiawan]:NanJing

  Organization Name (eg, company) [My Directory Sdn Bhd]:Wiscom System Co.,Ltd

  Organizational Unit Name (eg, section) [Secure Web Server]:ACSTAR

  Common Name (eg, www.domain.com) []:acmail.wiscom.com.cn

  Email Address []:acmail@wiscom.com.cn

  這樣就生成了server.csr和server.key這兩個(gè)文件。

  還需要簽署一下才能使用的:

  # ./sign-server-cert.sh server

  CA signing: server.csr -> server.crt:

  Using configuration from ca.config

  Enter pass phrase for ./ca.key: (輸入上面設(shè)置的根證書密碼)

  Check that the request matches the signature

  Signature ok

  The Subject's Distinguished Name is as follows

  countryName :PRINTABLE:'CN'

  stateOrProvinceName :PRINTABLE:'JiangSu'

  localityName :PRINTABLE:'NanJing'

  organizationName :PRINTABLE:'Wiscom System Co.,Ltd'

  organizationalUnitName:PRINTABLE:'ACSTAR'

  commonName :PRINTABLE:'acmail.wiscom.com.cn'

  emailAddress :IA5STRING:'acmail@wiscom.com.cn'

  Certificate is to be certified until Jul 16 12:55:34 2005 GMT (365 days)

  Sign the certificate? [y/n]:y

  1 out of 1 certificate requests certified, commit? [y/n]y

  Write out database with 1 new entries

  Data Base Updated

  CA verifying: server.crt <-> CA cert

  server.crt: OK

  (如果這里出現(xiàn)錯(cuò)誤,最好重新來過,刪除ssl.ca-0.1這個(gè)目錄,從解壓縮處重新開始。)

  下面要按照ssl.conf里面的設(shè)置,將證書放在適當(dāng)?shù)奈恢谩?BR>
  # chmod 400 server.key

  # cd ..

  # mkdir ssl.key

  # mv ssl.ca-0.1/server.key ssl.key

  # mkdir ssl.crt

  # mv ssl.ca-0.1/server.crt ssl.crt

  然后就可以啟動(dòng)啦!

  # cd /usr/local/apache2

  # ./bin/apachectl startssl

  對(duì)于這個(gè)提示:

  httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

  只需要編輯httpd.conf,找到ServerName xxxx這一行,去掉前面的注釋即可。

熱詞搜索:

上一篇:Solaris9(intelx86)下從源代碼安裝Tomcat5實(shí)戰(zhàn)記錄
下一篇:JBoss技術(shù)支持文檔

分享到: 收藏
主站蜘蛛池模板: 牙克石市| 自贡市| 临夏市| 葫芦岛市| 靖江市| 英吉沙县| 德清县| 翼城县| 习水县| 仲巴县| 盐池县| 台安县| 兰州市| 台州市| 丽江市| 专栏| 贵定县| 民乐县| 七台河市| 乃东县| 克山县| 青田县| 鸡西市| 福贡县| 武陟县| 大足县| 江安县| 兴文县| 禄劝| 许昌市| 唐海县| 轮台县| 姚安县| 建水县| 玉田县| 双柏县| 公安县| 岗巴县| 嘉祥县| 安阳县| 湖州市|