【Linux基础运维】安装部署nginx

时间:2020-12-04 11:24:20   收藏:0   阅读:9

安装部署nginx


方式一:编译安装

安装依赖:yum install -y gcc gcc-c++ make zlib zlib-devel libtool opennssl openssl-devel pcre pcre-devel

nginx的下载链接:http://nginx.org/en/download.html

下载tar解压缩后,configure、make、make install三步走。

  1. 添加nginx用户:useradd -s /sbin/nologin -M nginx
  2. 预编译:./configure --user=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
  3. 预编译成功后,编译:make(可以根据CPU核数,添加-j选项加快编译速度)
  4. 编译安装:make install

启动:/usr/local/nginx/sbin/nginx,或者指定配置文件:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

方式二:软件源安装

使用yum、apt等包管理器安装

方式三:docker安装

简单测试

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!