linux下安裝nginx

來源:互聯網
上載者:User

標籤:war   pst   set   ack   div   網盤下載   logs   ups   index   

下載nginx:    wget http://nginx.org/download/nginx-1.8.0.tar.gz
下載openssl : wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
下載zlib    : wget http://zlib.net/zlib-1.2.8.tar.gz
下載pcre    : wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz

http://pan.baidu.com/s/1qXZdvm0   //百度網盤 後倆個網址出錯請網盤下載上傳
----------------------------------------------------

分別編譯安裝

[[email protected]] tar zxvf openssl-fips-2.0.9.tar.gz

[[email protected]] cd openssl-fips-2.0.9

[[email protected]] ./config && make && make install

----------------------------------------------------

[[email protected]] tar zxvf pcre-8.36.tar.gz

[[email protected]] cd pcre-8.36

[[email protected]]  ./configure && make && make install

----------------------------------------------------

[[email protected]]tar zxvf zlib-1.2.8.tar.gz

[[email protected]] cd zlib-1.2.8

[[email protected]]  ./configure && make && make install

----------------------------------------------------

[[email protected]]tar zxvf nginx-1.8.0.tar.gz

[[email protected]] cd nginx-1.8.0

[[email protected]]  ./configure && make && make install

----------------------------------------------------
 啟動nginx
[[email protected]] ./usr/local/nginx/sbin/nginx

----------------------------------------------------

簡單測試nginx 在本機啟動啟動個tomcat

配置nginx設定檔

[[email protected]] vi nginx.conf

upstream mysvr{
          
#tomcat1加權輪詢 server 127.0.0.1:8080 weight=1;
          #tomcat2 server
127.0.0.1:8081 weight=2; } #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 7979; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm;
       #請求轉向mysvr 定義的伺服器列表 proxy_pass http:
//mysvr; }

#nginx配置其他配置可參考http://www.cnblogs.com/knowledgesea/p/5199046.html

#同時啟動倆個tomcat自行百度。為了測試nginx代理可將倆個tomcat首頁更改,以便區別是哪個tomcat.

linux下安裝nginx

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.