博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
编译安装Nginx步骤详解
阅读量:3960 次
发布时间:2019-05-24

本文共 925 字,大约阅读时间需要 3 分钟。

编译安装Nginx步骤详解

1,去Nginx官方网站下载源码包并解压

curl -O 或wget 跟下载链接

tar -xf 解压

2,进入nginx解压后的目录执行./configure …

./configure --prefix=/usr/local/sc_nginx --user cali --group cali --with stream --with threads --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module

参数解释:

–prefix 用于指定nginx编译安装后的目录
–user 指定用户
–group 指定组
–with stream 启动nginx四层负载均衡(传输层)
–with threads 启动进程池模块
–with-http_ssl_module 启动nginx的https服务
–with-http_realip_module 启动realip模块
–with-http_stub_status_module 启动nignx的状态查看模块

其他模块:

日志记录模块ngx_http_log_module
压缩相关选项ngx_http_gzip_module
重定向模块ngx_http_rewrite_module
引用模块ngx_http_referer_module
反向代理模块ngx_http_proxy_module

更多模块详情

注:

直接执行上述的./configure 命令 可能会出错,需要我们手动解决依赖关系,根据提示安装一些依赖包,一般需要安装:
yum install pcre-devel gcc openssl-devel -y

3,编译安装

make && make install
安装后可看到指定目录的目录结构

4,启动nginx

  1. 先创建一个软链接:ln -s /usr/local/sc_nginx/sbin/nginx /usr/bin/nginx
  2. nginx start 启动nginx
  3. ps aux |grep nginx 查看nginx进程是否启动

转载地址:http://emlzi.baihongyu.com/

你可能感兴趣的文章