centos 7 编译安装nginx-1.22

yum install gd gd-devel -y
yum install pcre-devel openssl-devel  libxml2-devel  libxslt-devel -y
wget http://nginx.org/download/nginx-1.22.0.tar.gz //下载源码
tar -zxvf nginx-1.22.0.tar.gz //解压缩
cd nginx-1.22.0
//配置编译项
./configure  --prefix=/usr/local/nginx --user=www --group=www --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-stream  --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module
make && make install  //编译并安装


编写启动脚本, 用于systemctl 管理.

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容