知识库

标准化实施手册及常见错误


手动、自动安装nginx

<h3>自动安装</h3> <p>点击下载安装包:<a href="http://101.69.243.254:5010/share/VKGbZ21q">http://101.69.243.254:5010/share/VKGbZ21q</a></p> <h3>手动安装</h3> <h4>准备编译环境</h4> <pre><code class="language-shell">yum -y install gcc-c++ pcre* unzip</code></pre> <h4>将包上传至服务器并解压</h4> <pre><code class="language-shell"># 将以下安装包上传至/home目录下执行解压 tar -xvf nginx-1.17.9.tar.gz tar -xvf openssl-1.1.1e.tar.gz tar -xvf pcre-8.44.tar.gz tar -xvf zlib-1.2.11.tar.gz unzip nginx_upstream_check_module-master.zip unzip nginx-goodies-nginx-sticky-module-ng-08a395c66e42.zip</code></pre> <h4>开始安装</h4> <pre><code class="language-shell">cd nginx-1.17.9/ chmod +x configure # 赋予执行权限 # 转换成二进制 ./configure --prefix=/risen/soft/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-http_ssl_module --with-http_v2_module \ --with-pcre=/home/pcre-8.44 --with-zlib=/home/zlib-1.2.11 --with-openssl=/home/openssl-1.1.1e \ --add-module=/home/nginx-goodies-nginx-sticky-module-ng-08a395c66e42 \ --add-module=/home/nginx_upstream_check_module-master make # 编译 make install # 安装</code></pre> <h4>开启nginx服务并开机自启</h4> <pre><code class="language-shell">vim /lib/systemd/system/nginx.service [Unit] Description=nginx.service After=network.target [Service] Type=forking ExecStart=/risen/soft/nginx/sbin/nginx ExecReload=/risen/soft/nginx/sbin/nginx -s reload ExecStop=/risen/soft/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target systemctl daemon-reload # #重新加载systemd systemctl enable nginx.service # 开机自启 systemctl status/start/stop nginx.service</code></pre>

页面列表

ITEM_HTML