溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Linux下nginx編譯安裝教程

發布時間:2021-08-26 20:15:33 來源:億速云 閱讀:125 作者:chen 欄目:建站服務器

本篇內容介紹了“Linux下nginx編譯安裝教程”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

一、必要軟件準備
1.安裝pcre

為了支持rewrite功能,我們需要安裝pcre
復制代碼 代碼如下:# yum install pcre* //如過你已經裝了,請跳過這一步

2.安裝openssl

需要ssl的支持,如果不需要ssl支持,請跳過這一步
復制代碼 代碼如下:# yum install openssl*

3.gzip 類庫安裝

復制代碼 代碼如下:yum install zlib zlib-devel

4.安裝wget

下載nginx使用,如果已經安裝,跳過這一步
復制代碼 代碼如下:# yum install wget

二、安裝nginx

1.下載
復制代碼 代碼如下:wget  http://nginx.org/download/nginx-1.7.0.tar.gz
2.解壓
復制代碼 代碼如下:
tar -zxvf nginx-1.7.0.tar.gz

3.編譯和安裝
執行如下命令:
復制代碼 代碼如下:

cd nginx-1.7.0

./configure --prefix=/usr/local/nginx-1.7.0 \

–with-http_ssl_module --with-http_spdy_module 
–with-http_stub_status_module --with-pcre
–with-http_stub_status_module:支持nginx狀態查詢
–with-http_ssl_module:支持https
–with-http_spdy_module:支持google的spdy,想了解請百度spdy,這個必須有ssl的支持
–with-pcre:為了支持rewrite重寫功能,必須制定pcre

最后輸出如下內容,表示configure OK了。

復制代碼 代碼如下:
checking for zlib library … found
creating objs/Makefile
Configuration summary

  • using system PCRE library

  • using system OpenSSL library

  • md5: using OpenSSL library

  • sha1: using OpenSSL library

  • using system zlib library
    nginx path prefix: “/usr/local/nginx-1.7.0”
    nginx binary file: “/usr/local/nginx-1.7.0/sbin/nginx”
    nginx configuration prefix: “/usr/local/nginx-1.7.0/conf”
    nginx configuration file: “/usr/local/nginx-1.7.0/conf/nginx.conf”
    nginx pid file: “/usr/local/nginx-1.7.0/logs/nginx.pid”
    nginx error log file: “/usr/local/nginx-1.7.0/logs/error.log”
    nginx http access log file: “/usr/local/nginx-1.7.0/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”

make //確定你的服務器有安裝make,如果沒有安裝請執行yum install make

make install

三、啟動、關閉、重置nginx

啟動:直接執行以下命令,nginx就啟動了,不需要改任何配置文件,nginx配置多域名虛擬主機請參考后續文章.
復制代碼 代碼如下:/usr/local/nginx-1.7.0/sbin/nginx
試試訪問:直接使用curl命令來讀取web信息
復制代碼 代碼如下:
[root@ns conf]

curl -s  http://localhost  | grep  nginx.com

nginx.com .
關閉:
復制代碼 代碼如下:/usr/local/nginx-1.7.0/sbin/nginx -s stop

“Linux下nginx編譯安裝教程”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女