centos下安裝nginx

來源:互聯網
上載者:User

標籤:style   blog   http   color   strong   檔案   

Nginx 伺服器就不贅述了,此軟體在大流量、高並發的情況下,效能非常優越,而且佔用的CPU和記憶體資源非常之低!

請確認有 PCRE 庫,如果沒有,請安裝之,因為Nginx 的 Rewrite 模組需要它。

[plain] view plaincopyprint?
  1. yum -y install pcre pcre-devel  
yum -y install pcre pcre-devel

 

下面開始安裝Nginx:

 

[plain] view plaincopyprint?
  1. wget http://nginx.org/download/nginx-1.0.2.tar.gz  
  2. tar zxvf nginx-1.0.2.tar.gz  
  3. cd nginx-1.0.2  
  4. ./configure --prefix=/usr/local/nginx  
  5. make  
  6. make install  
wget http://nginx.org/download/nginx-1.0.2.tar.gztar zxvf nginx-1.0.2.tar.gzcd nginx-1.0.2./configure --prefix=/usr/local/nginxmakemake install

當然,也可以選擇更為簡單的安裝方式:

 

 

[plain] view plaincopyprint?
  1. yum install nginx  
yum install nginx

安裝完成後,操作Nginx :

 

[plain] view plaincopyprint?
  1. /usr/local/nginx/sbin/nginx              啟動 Nginx  
  2. /usr/local/nginx/sbin/nginx -s stop      停止 Nginx  
  3. /usr/local/nginx/sbin/nginx -s reload    重啟 Nginx  
/usr/local/nginx/sbin/nginx              啟動 Nginx/usr/local/nginx/sbin/nginx -s stop      停止 Nginx/usr/local/nginx/sbin/nginx -s reload    重啟 Nginx

 

在瀏覽器中輸入:

 

 

[plain] view plaincopyprint?
  1. http://127.0.0.1 或 http://localhost  
http://127.0.0.1 或 http://localhost

頁面顯示" OK ",表明安裝成功!

 

關於Nginx 的設定檔,就不多說了,可以參考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.