zl程序教程

您现在的位置是:首页 >  其他

当前栏目

nginx源码编译安装记录

2023-02-26 12:28:27 时间

nginx 源码安装过程

参考 https://cloud.tencent.com/developer/article/1619507

(福利推荐:阿里云、腾讯云、华为云服务器最新限时优惠活动,云服务器1核2G仅88元/年、2核4G仅698元/3年,点击这里立即抢购>>>

  1. nginx源码包下载:http://nginx.org/download/nginx-1.17.0.tar.gz
  2. 安装库
    GCC编译器:yum install gcc gcc-c++
    正则表达式PCRE库:yum install -y pcre pcre-devel
    zlib压缩库:yum install -y zlib zlib-devel
    OpenSSL开发库:yum install -y openssl openssl-devel
  3. 安装
    tar -axv -f nginx-1.17.0.tar.gz && cd nginx-1.17.0
./configure  --prefix=/etc/nginx  --sbin-path=/usr/sbin/nginx  --conf-path=/etc/nginx/nginx.conf  --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/nginx/access.log  --pid-path=/run/nginx.pid  --lock-path=/var/run/nginx.lock  --http-client-body-temp-path=/var/cache/nginx/client_temp  --http-proxy-temp-path=/var/cache/nginx/proxy_temp  --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp  --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp  --http-scgi-temp-path=/var/cache/nginx/scgi_temp  --user=nginx  --group=nginx  --with-compat  --with-file-aio  --with-threads  --with-http_addition_module  --with-http_auth_request_module  --with-http_dav_module  --with-http_flv_module  --with-http_gunzip_module  --with-http_gzip_static_module  --with-http_mp4_module  --with-http_random_index_module  --with-http_realip_module  --with-http_secure_link_module  --with-http_slice_module  --with-http_ssl_module  --with-http_stub_status_module  --with-http_sub_module  --with-http_v2_module  --with-mail  --with-mail_ssl_module  --with-stream  --with-stream_realip_module  --with-stream_ssl_module  --with-stream_ssl_preread_module  --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB"

make && make install

  1. 添加系统服务 /usr/lib/systemd/system/nginx.service
[Unit] Description=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target  [Service] Type=forking PIDFile=/run/nginx.pid # Nginx will fail to start if /run/nginx.pid already exists but has the wrong # SELinux context. This might happen when running `nginx -t` from the cmdline. # https://bugzilla.redhat.com/show_bug.cgi?id=1268621 ExecStartPre=/usr/bin/rm -f /run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/bin/kill -s HUP $MAINPID KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true  [Install] WantedBy=multi-user.target
  1. 执行以下命令重载配置
    systemctl daemon-reload
  2. 启动nginx并设置为开机自启

    systemctl start nginx
    systemctl enable nginx

nginx源码编译安装记录


本站部分内容转载自网络,版权属于原作者所有,如有异议请联系QQ153890879修改或删除,谢谢!
转载请注明原文链接:nginx源码编译安装记录

你还在原价购买阿里云、腾讯云、华为云、天翼云产品?那就亏大啦!现在申请成为四大品牌云厂商VIP用户,可以3折优惠价购买云服务器等云产品,并且可享四大云服务商产品终身VIP优惠价,还等什么?赶紧点击下面对应链接免费申请VIP客户吧:

1、点击这里立即申请成为腾讯云VIP客户

2、点击这里立即注册成为天翼云VIP客户

3、点击这里立即申请成为华为云VIP客户

4、点击这里立享阿里云产品终身VIP优惠价

喜欢 (0)
[[email protected]]
分享 (0)