Nginx 安装部署

参数文档:http://nginx.org/en/#basic_http_features

官方部署文档:https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/

下载地址:http://nginx.org/download/
最新稳定版:https://nginx.org/download/nginx-1.16.1.tar.gz

部署
  • 下载依赖
官网阐述如下:
Installing NGINX Dependencies
Prior to compiling NGINX Open Source from source, you need to install libraries for its dependencies:

在從源代碼編譯NGINX開源之前,您需要安裝依賴項的庫:

PCRE –支持正則表達式。NGINX 核心和重寫模塊需要。

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.43.tar.gz
$ tar -zxf pcre-8.43.tar.gz
$ cd pcre-8.43
$ ./configure
$ make
$ sudo make install

zlib –支持標頭壓縮。NGINX Gzip模塊需要。

$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure
$ make
$ sudo make install

OpenSSL –支持HTTPS協議。NGINX SSL模塊和其他模塊需要。

$ wget http://www.openssl.org/source/openssl-1.1.1c.tar.gz
$ tar -zxf openssl-1.1.1c.tar.gz
$ cd openssl-1.1.1c
$ ./Configure darwin64-x86_64-cc --prefix=/usr
$ make
$ sudo make install

也可直接使用yum安装相关依赖

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel

  • 安装pcre
[root@bogon src]# cd /usr/local/src/
[root@bogon src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@bogon src]# tar zxvf pcre-8.35.tar.gz
[root@bogon src]# cd pcre-8.35
[root@bogon pcre-8.35]# ./configure
[root@bogon pcre-8.35]# make && make install
[root@bogon pcre-8.35]# pcre-config --version
  • 安装nginx
[root@hadoop001 nginx-1.16.1]#  wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@hadoop001 nginx-1.16.1]# tar -xzvf nginx-1.16.1.tar.gz
[root@hadoop001 nginx-1.16.1]# cd nginx-1.16.1

--prefix:安装路径

[root@hadoop001 nginx-1.16.1]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@hadoop001 nginx-1.16.1]# make
[root@hadoop001 nginx-1.16.1]# make install
[root@hadoop001 nginx]# pwd
/usr/local/nginx
[root@hadoop001 nginx]# cd sbin
[root@hadoop001 sbin]# ll
total 5872
-rwxr-xr-x. 1 root root 6009872 Mar  9 14:13 nginx

==启动==
[root@hadoop001 sbin]# ./nginx
[root@hadoop001 sbin]# ps -ef|grep nginx
root      13870      1  0 14:19 ?        00:00:00 nginx: master process ./nginx
nobody    13871  13870  0 14:19 ?        00:00:00 nginx: worker process
root      13883   2124  0 14:19 pts/0    00:00:00 grep --color=auto nginx
==停止==
[root@hadoop001 sbin]# ./nginx -s stop

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值