nginx 新手攻略 Ubuntu Linux下安裝配置教程

來源:互聯網
上載者:User

標籤:style   http   io   color   ar   os   sp   for   strong   

能提供各種服務端管理工具包的極客們,請聯絡我,將給予ftp上傳許可權,牆內太坑了

下載gzip 模組需要 zlib 庫

囧囧明主機zlib:


 wget ftp://www.xuwenming.net/nginx/zlib-1.2.8.tar.gz --ftp-user=ftp1 --ftp-password=ftp1

官方zlib:

wget http://liquidtelecom.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz

下載rewrite模組需要的pcre庫

囧囧明主機pcre:

 wget ftp://www.xuwenming.net/nginx/pcre-8.35.tar.gz --ftp-user=ftp1 --ftp-password=ftp1

pcre官方:

wget http://softlayer-sng.dl.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

下載ssl 功能需要 openssl 庫

囧囧明的主機openssl:

 wget ftp://www.xuwenming.net/nginx/openssl-1.0.1j.tar.gz --ftp-user=ftp1 --ftp-password=ftp1

or openssl官方

wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz




下載nginx

我自己主機nginx:

 wget ftp://www.xuwenming.net/nginx/nginx-1.6.0.tar.gz --ftp-user=ftp1 --ftp-password=ftp1

or nginx官方:

wget http://nginx.org/download/nginx-1.6.0.tar.gz


這下載速度確實有點坑爹

稍後給大家放上自己的ftp伺服器供下載

確定都下載好了以後 進入編譯安裝步驟 

編譯安裝openssl

 tar -zxvf openssl-1.0.1j.tar.gz cd openssl-1.0.1j ./config  make make install



編譯安裝zlib

tar -zxvf zlib-1.2.8.tar.gzcd zlib-1.2.8./configure makemake install

以上操作三個組件都進行一次編譯安裝


編譯安裝pcre

tar -zxvf pcre-8.35.tar.gzcd pcre-8.35./configure makemake install


我的Ubuntu安裝pcre的時候報錯:

: error: You need a C++ compiler for C++ support.

看來ubuntu需要編譯C++支援

 sudo apt-get install build-essential

然後再執行一邊pcre的編譯安裝過程就ok 沒有報錯啦


最後安裝nginx

tar -zxvf nginx-1.6.0.tar.gz cd nginx-1.6.0./configure --with-pcre=../pcre-8.35 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-1.0.1jmakemake install


nginx配置好的路徑存著以後方便查詢修改

  nginx path prefix: "/usr/local/nginx"  nginx binary file: "/usr/local/nginx/sbin/nginx"  nginx configuration prefix: "/usr/local/nginx/conf"  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"  nginx pid file: "/usr/local/nginx/logs/nginx.pid"  nginx error log file: "/usr/local/nginx/logs/error.log"  nginx http access log file: "/usr/local/nginx/logs/access.log"  nginx http client request body temporary files: "client_body_temp"  nginx http proxy temporary files: "proxy_temp"  nginx http fastcgi temporary files: "fastcgi_temp"  nginx http uwsgi temporary files: "uwsgi_temp"  nginx http scgi temporary files: "scgi_temp"


注意這幾個檔案的版本號碼 否則安裝失敗

檢查一下自己的勞動成果

cd  /usr/local/nginx/sbin && ./nginx -t

啟動nginx

./nginx

如果失敗 用sudo許可權 試一試

或者查看本機是不是還有apache之類的什麼web服務工具

最後查看一下

 netstat -ntlp


最後再為系統配置個軟連結到全域命令

ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

然後切換到任意目錄 試一試吧

nginx -v


nginx 新手攻略 Ubuntu Linux下安裝配置教程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.