美文网首页
源码编译安装Nginx 和安装https模块

源码编译安装Nginx 和安装https模块

作者: 萤火虫de梦 | 来源:发表于2019-06-14 14:33 被阅读0次

安装依赖模块:

yum install -y pcre-devel
yum -y install openssl openssl-devel

添加nginx组合用户

# groupadd -r nginx

# useradd -g nginx -r nginx

获取nginx源码,此次测试中没有使用较新的版本,为nginx-1.12.2

  # wget http://nginx.org/download/nginx-1.12.2.tar.gz

  # tar -zxvf nginx-1.12.2.tar.gz 

  # cd nginx-1.12.2.tar.gz

编译安装nginx

  # ./configure --prefix=/usr/local/nginx

    --conf-path=/etc/nginx/nginx.conf

    --user=nginx --group=nginx

    --error-log-path=/var/log/nginx/error.log

    --http-log-path=/var/log/nginx/access.log

    --pid-path=/var/run/nginx/nginx.pid

    --lock-path=/var/lock/nginx.lock

    --with-http_ssl_module   #支持ssl模块

    --with-http_stub_status_module

    --with-http_gzip_static_module

    --http-client-body-temp-path=/var/tmp/nginx/client

    --http-proxy-temp-path=/var/tmp/nginx/proxy

    --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi

    --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
``
# make && make install

创建相应的目录

  # mkdir -pv /var/tmp/nginx/{client,proxy,fastcgi,uwsgi}

支持nginx安装完成,先测试一下nginx服务是否能正常启动,并提供web服务

# /usr/local/nginx/sbin/nginx

# ss -tnlp

此时若是看到80端口已然被监听,则nginx正常运行```



相关文章

网友评论

      本文标题:源码编译安装Nginx 和安装https模块

      本文链接:https://www.haomeiwen.com/subject/gwtpfctx.html