nginx安装

1 安装gcc依赖

yum install -y gcc gcc-c++

2 安装pcre软件包(使nginx支持http rewrite模块)
yum install -y pcre
yum install -y pcre-devel

3 安装openssl-devel(使nginx支持ssl)
yum install -y openssl-devel

4 安装zlib库支持

yum install -y zlib zlib-devel

5 下载nginx
wget http://nginx.org/download/nginx-1.15.4.tar.gz

6 解压包
tar xvf nginx-1.15.4.tar.gz

7 进入nginx解压目录,运行配置

(1)运行默认安装配置

./configure

配置完成后会显示默认的安装路径:

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/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"

注:默认安装在/usr/local/nginx目录下

(2)也可以指定配置参数安装,以及astdfs-nginx-module插件

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/local/nginx/nginx.pid \
--lock-path=/var/lock/nginx/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 \
--add-module=/opt/setups/FastDFS/fastdfs-nginx-module/src

8 编译

make

9 编译安装

make install

10 启动

cd /usr/local/nginx/sbin

./nginx -c /xxxxx/nginx.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值