Nginx编译安装步骤如下:
nginx-1.26.2.tar.gz),使用wget或curl命令。gcc、pcre-devel、zlib-devel、openssl-devel)。
apt install build-essential libpcre3-dev zlib1g-dev libssl-devyum install gcc pcre-devel zlib-devel openssl-develtar -zxvf命令解压至指定目录。./configure脚本,指定安装路径、启用模块(如--with-http_ssl_module)等参数。
--prefix(安装路径)、--user/--group(运行用户)、--with-http_ssl_module(HTTPS支持)等。make编译,make install安装至指定目录。nginx),并设置文件权限。PATH,方便全局调用。/usr/local/nginx/sbin/nginx启动,或创建systemd服务文件实现开机自启。说明:具体模块可根据需求调整,生产环境建议启用--with-http_ssl_module、--with-http_v2_module等模块。