Ubuntu10下Nginx-0.8.54安裝

Ubuntu10Nginx-0.8.54安裝

下載nginx-0.8.54.tar.gz,解壓並編譯安裝

命令說明:

tar(z- gzip 對存檔壓縮或解壓;x-從存檔展開文件;v-詳細顯示處理的文件;f-指定存檔或設備)

tar –zxvf nginx-0.8.54.tar.gz

進入相關目錄

./configure

make

sudo make install

你要運氣好的話,一切ok,不過相信沒有人運氣好的,哈哈。Ubuntu默認的策略是什麼庫都不裝,依賴的庫都需要自已手工安裝搞定。估計CentOSlinux會好一些。

一般都會出錯的,那麼我們來看看可能出現的問題。

常見問題解決

缺少pcre library

./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.

 

解決方法:下載安裝pcre-8.12解決問題,解壓後對pcre進行如下操作

./configure

make

sudo make install

運氣好一次通過,運氣不好,make pcre時會出錯

缺少gcc-c++libtool,也就是c++編譯包

libtool: compile: unrecognized option `-DHAVE_CONFIG_H'

libtool: compile: Try `libtool --help' for more information.

make[1]: *** [pcrecpp.lo] Error 1

make[1]: Leaving directory `/home/guangbo/work/pcre-8.12'

make: *** [all] Error 2

guangbo@guangbo-laptop:~/work/pcre-8.12$ libtool -help -DHAVE_CONFIG_H

The program 'libtool' is currently not installed.  You can install it by typing:

sudo apt-get install libtool

guangbo@guangbo-laptop:~/work/pcre-8.12$

 

解決方法:需要先安裝libtoolgcc-c++

sudo apt-get install libtool

sudo apt-get install gcc-c++

 

安裝 gcc-c++出錯

guangbo@guangbo-laptop:~/soft/pcre-8.12$ sudo apt-get install gcc-c++

Reading package lists... Done

Building dependency tree      

Reading state information... Done

E: Couldn't find package gcc-c

 

解決辦法:更新源,重新安裝gcc-c++

sudo apt-get install build-essential

sudo apt-get update #更新源

sudo apt-get install gcc-c++

upgrade更新的話會花很長時間,如果不報錯,可以不進行。

sudo apt-get upgrade #更新已安裝的包,更新會很久

 

缺少openssl

./configure: error: the HTTP cache module requires md5 functions

from OpenSSL library.  You can either disable the module by using

--without-http-cache option, or install the OpenSSL library into the system,

or build the OpenSSL library statically from the source with nginx by using

--with-http_ssl_module --with-openssl=<path> options.

 

解決辦法:

sudo apt-get install openssl

 

缺少zlib

./configure: error: the HTTP gzip module requires the zlib library.

You can either disable the module by using --without-http_gzip_module

option, or install the zlib library into the system, or build the zlib library

statically from the source with nginx by using --with-zlib=<path> option.

 

解決方法:直接下載一個libssl-dev安裝,這個包應該也可以解決openssl的問題.

sudo apt-get install libssl-dev

 

沒有nginx,logs目錄訪問權限

[alert]: could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)

2011/03/21 06:09:33 [emerg] 24855#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)

 

 

解決辦法:

sudo chmod a+rwx -R logs

sudo chmod a+rwx -R /usr/local/nginx

 

測試安裝是否成功

nginx,編譯安裝沒問題後,正式安裝並運行

sudo apt-get install nginx

/usr/local/nginx/sbin/nginx

 

瀏覽器中打開http://localhost,成功看到歡迎界面

 

關閉nginx

./sbin/nginx -s stop

 

Ubuntu Linux實用命令

tar(z- gzip 對存檔壓縮或解壓;x-從存檔展開文件;v-詳細顯示處理的文件;f-指定存檔或設備)

tar –zxvf nginx-0.8.54.tar.gz

 

ip查看

ifconfig

 

編譯

make

 

安裝編譯好的源碼包

make install

 

編輯文件

sudo gedit  /etc/profile

 

修改根限:chmod說明(u:與文件屬主擁有一樣的權限[a:所有人]+:增加權限;rwx:可讀可寫可執行)

-R:遞歸所有目錄和文件

sudo chmod a+rwx -R logs

 

檢查是庫是否安裝成功

dpkg --list|grep openssl

 

下載安裝庫

sudo apt-get install libtool

 

檢查服務啓動是否正常

ps -ef|grep

 

查找openssl安裝路徑

whereis openssl

 

更新源

sudo apt-get update

 

更新已安裝的包

sudo apt-get upgrade

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章