灵易深论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 98|回复: 0

二进制部署NGINX

[复制链接]

70

主题

9

回帖

176

积分

管理员

积分
176
发表于 2025-1-3 18:35:28 | 显示全部楼层 |阅读模式
二进制部署NGINX
sudo apt-get update
sudo apt-get install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
cd /usr/local/src
wget http://nginx.org/download/nginx-1.24.0.tar.gz  # 使用最新稳定版本
tar -xzvf nginx-1.24.0.tar.gz
cd nginx-1.24.0
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module
make
sudo make install
sudo vi /etc/init.d/nginx
#!/bin/bash
# Nginx control script
NGINX_PATH="/usr/local/nginx/sbin/nginx"
case "$1" in
    start)
        echo "Starting Nginx..."
        $NGINX_PATH
        ;;
    stop)
        echo "Stopping Nginx..."
        $NGINX_PATH -s stop
        ;;
    restart)
        echo "Restarting Nginx..."
        $NGINX_PATH -s stop
        sleep 1
        $NGINX_PATH
        ;;
    reload)
        echo "Reloading Nginx..."
        $NGINX_PATH -s reload
        ;;
    status)
        ps aux | grep nginx
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1
        ;;
esac
exit 0
sudo chmod +x /etc/init.d/nginx
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx restart
sudo /etc/init.d/nginx reload
sudo /etc/init.d/nginx status

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|灵易深论坛 ( 沪ICP备2020036158号-2 )

GMT+8, 2025-6-21 21:46 , Processed in 0.015467 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表