nginx安装

将nginx 源码包下载下来,官网下载地址:http://nginx.org/en/download.html,选择stable verson 版本,以nginx-1.18.0 为例,材料包中已下载,进入存放nginx-1.18.0.tar.gz源码包的目录,用解压命令解压到当前目录

tar -xzvf nginx-1.18.0.tar.gz

进入解压后的nginx-1.18.0 目录里,使用cofigure命令生成一个Makefile 文件

单独指定安装路径:/data/nginx 的配置

./configure   \
--prefix=/data/nginx \
--sbin-path=/home/nstcapp/nginx/sbin/nginx \
--conf-path=/home/nstcapp/nginx/conf/nginx.conf \
--pid-path=/home/nstcapp/nginx/nginx.pid \
--with-http_ssl_module \
--with-http_gzip_static_module

在nginx-1.18.0 目录下执行

make&&make install

源码编译完成后在/data目录下生成nginx文件夹

四、启动 nginx

进入nginx 生成目录下的sbin目录启动nginx

cd /data/nginx/sbin  && ./nginx

 

posted @ 2023-07-14 15:07  涂山有雨  阅读(9)  评论(0编辑  收藏  举报