【Nginx】源码安装
源码
安装必要的软件
yum -y install gcc cc cl pcre pcre-devel openssl openssl-devel zlib zlib-devel
下载解压源码
cd usr/local/src mkdir nginx cd nginx wget https://nginx.org/download/nginx-1.24.0.tar.gz tar zxvf nginx-1.24.0.tar.gz
创建程序目录
mkdir -p /data/nginx
安装
./configure --prefix=/data/nginx --sbin-path=/data/nginx/bin/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
不指定--sbin-path时生成的二进制文件默认路径为/data/nginx/sbin/nginx
启动
cd /data/nginx/bin # 测试配置文件 ./nginx -t -c /data/nginx/conf/nginx.conf # 配置没问题时启动 ./nginx -c /data/nginx/conf/nginx.conf # 配置修改重新加载 ./nginx -s reload # 快速停止 ./nginx -s stop # 完整有序的停止 ./nginx -s quit # 重新打开日志文件 ./nginx -s reopen
docker
docker pull nginx:1.23.4 docker run -d --name nginx -p 80:80 -p 443:443 --privileged=true
-v /ycx/data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro
-v /ycx/data/nginx/conf.d:/etc/nginx/conf.d:ro
-v /ycx/data/nginx/html:/usr/share/nginx/html:ro
-v /ycx/data/nginx/log:/var/log/nginx
nginx:1.23.4

浙公网安备 33010602011771号