nginx安裝

一. gcc 安裝
yum install gcc-c++
二. PCRE pcre-devel 安裝
PCRE(Perl Compatible Regular Expressions) 是一個Perl庫,包括 perl 兼容的正則表達式庫。nginx 的 http 模塊使用 pcre 來解析
正則表達式,所以需要在 linux 上安裝 pcre 庫,pcre-devel 是使用 pcre 開發的一個二次開發庫。nginx也需要此庫。命令:
yum install -y pcre pcre-devel
三. zlib 安裝
zlib 庫提供了很多種壓縮和解壓縮的方式, nginx 使用 zlib 對 http 包的內容進行 gzip ,所以需要在 Centos 上安裝 zlib 庫。
yum install -y zlib zlib-devel
四. OpenSSL 安裝
OpenSSL 是一個強大的安全套接字層密碼庫,囊括主要的密碼算法、常用的密鑰和證書封裝管理功能及 SSL 協議,并提供豐富的
應用程序供測試或其它目的使用。
nginx 不僅支持 http 協議,還支持 https(即在ssl協議上傳輸http),所以需要在 Centos 安裝 OpenSSL 庫。
yum install -y openssl openssl-devel

1.nginx包下載:直接下載.tar.gz安裝包,地址:https://nginx.org/en/download.html
2.使用wget命令下載(推薦)。確保系統已經安裝了wget,如果沒有安裝,執行 yum install wget 安裝。
3.解壓
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
4.配置
./configure

自定義配置(不推薦)
./configure
--prefix=/usr/local/nginx
--conf-path=/usr/local/nginx/conf/nginx.conf
--pid-path=/usr/local/nginx/conf/nginx.pid
--lock-path=/var/lock/nginx.lock
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--with-http_gzip_static_module
--http-client-body-temp-path=/var/temp/nginx/client
--http-proxy-temp-path=/var/temp/nginx/proxy
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi
--http-scgi-temp-path=/var/temp/nginx/scgi
5.編譯安裝
make&&make install
查找安裝路徑:
whereis nginx
查詢nginx進程:(ps命令需要安裝yum install net-tools)
ps aux|grep nginx

開機自啟動
vi /etc/rc.local
增加一行 /usr/local/nginx/sbin/nginx
設置執行權限:
chmod 755 rc.local

Nginx負載均衡配置實戰 http://www.linuxidc.com/Linux/2014-12/110036.htm

CentOS 6.2實戰部署Nginx+MySQL+PHP http://www.linuxidc.com/Linux/2013-09/90020.htm

使用Nginx搭建WEB服務器 http://www.linuxidc.com/Linux/2013-09/89768.htm

搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服務器全過程 http://www.linuxidc.com/Linux/2013-09/89692.htm

CentOS 6.3下Nginx性能調優 http://www.linuxidc.com/Linux/2013-09/89656.htm

CentOS 6.3下配置Nginx加載ngx_pagespeed模塊 http://www.linuxidc.com/Linux/2013-09/89657.htm

CentOS 6.4安裝配置Nginx+Pcre+php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm

Nginx安裝配置使用詳細筆記 http://www.linuxidc.com/Linux/2014-07/104499.htm

Nginx日志過濾 使用ngx_log_if不記錄特定日志 http://www.linuxidc.com/Linux/2014-07/104686.htm

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容