{"id":100937,"date":"2024-07-14T14:46:10","date_gmt":"2024-07-14T06:46:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=100937"},"modified":"2024-07-14T14:46:10","modified_gmt":"2024-07-14T06:46:10","slug":"centos7-new-nginx","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos7-new-nginx.html","title":{"rendered":"\u539f\u521b\uff1aCentos 7 \u6e90\u7801\u7f16\u8bd1\u5b89\u88c5 Nginx 1.13"},"content":{"rendered":"
\u5173\u4e8enginx\u7684\u76f8\u5173\u4ecb\u7ecd\u6211\u5c31\u4e0d\u8bf4\u4e86\uff0c\u65e2\u7136\u4f60\u9009\u62e9nginx\u4f5c\u4e3a\u4f60\u7684web\u670d\u52a1\u5668\uff0c\u60f3\u5fc5\u4f60\u591a\u5c11\u4e5f\u5bf9nginx server\u6709\u4e0d\u540c\u8ba4\u77e5\u548c\u7406\u89e3\uff0c\u63a5\u4e0b\u6765\u6211\u5c31\u76f4\u63a5\u5b89\u88c5\u3002<\/p>\n
<\/p>\n
\u6211\u4f7f\u7528\u7684\u662fcentos7.3 64\u4f4d\u6838\u5fc3\u7248\u7cfb\u7edf\uff0c\u5b89\u88c5\u914d\u7f6enginx\u524d\u5fc5\u987b\u5b89\u88c5nginx\u4f9d\u8d56\u5305\uff0c\u8bf7\u67e5\u770b\uff1bCentos 7\u7f16\u8bd1\u5b89\u88c5php7.1\u4e4b\u751f\u4ea7\u7bc7\uff0c\u5e76\u5b89\u88c5\u524d\u6587\u5f00\u5934\u6240\u63d0\u4f9b\u7684\u4f9d\u8d56\u5305\u3002\u6b64\u4f9d\u8d56\u7ec4\u4ef6\u5305\u9002\u7528\u4e8eNginx\u4efb\u610f\u7248\u672c\u3002<\/p>\n
\u65b0\u5efaweb\u7528\u6237\u548c\u7ec4<\/p>\n
\r\n$ \/usr\/sbin\/groupadd www\r\n$ \/usr\/sbin\/useradd -g www www\r\n$ ulimit -SHn 65535 \/\/\u8bbe\u7f6elinux\u9ad8\u8d1f\u8f7d\u53c2\u6570\r\n<\/pre>\n\u4ece\u5b98\u65b9\u4e0b\u8f7dNginx\u4ee5\u53caOpenSSL<\/strong><\/span><\/div>\n\u4e0b\u8f7dNginx\u65f6\u6709\u4e24\u4e2a\u7248\u672c\uff1a\u5f00\u53d1\u7248\u548c\u7a33\u5b9a\u7248\uff0c\u5982\u679c\u7528\u4e8e\u751f\u4ea7\u5c31\u4e0b\u8f7d\u7a33\u5b9a\u7248\u672c\uff0chttp:\/\/nginx.org\/en\/download.html (\u6700\u597d\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684\u7a33\u5b9a\u7248\uff0c\u8fd9\u6837\u4f1a\u6709bug\u4fee\u590d\u4ee5\u53ca\u65b0\u7279\u6027)\u6211\u4e0b\u8f7d\u7684\u662f\u5c31\u662f\u76ee\u524d\u6700\u65b0\u7248\u672cnginx-1.13.5\u3002<\/p>\n
\r\n$ cd \/tmp\r\n$ wget https:\/\/www.openssl.org\/source\/openssl-1.1.0e.tar.gz\r\n$ tar zxvf openssl-1.1.0e.tar.gz\r\n$ wget https:\/\/nginx.org\/download\/nginx-1.13.5.tar.gz\r\n$ tar zxvf nginx-1.13.5.tar.gz\r\n$ cd nginx-1.13.5\r\n<\/pre>\n\u5b89\u88c5Nginx<\/strong><\/span><\/div>\n\u4f60\u53ef\u80fd\u4f1a\u6ce8\u610f\u5230\u6709\u4e9b\u6587\u6863\u6559\u7a0b\u5b89\u88c5nginx\u7684\u65f6\u5019\uff0c\u5e76\u672a\u6307\u6d3e\u8fd9\u4e48\u591a\u6a21\u5757\uff0c\uff08\u770b\u8d77\u6765\u597d\u957f\uff09\uff0c\u6709\u7684\u8fde\u6a21\u5757\u548c\u7528\u6237\u90fd\u6ca1\u6709\u6307\u6d3e\uff0c\u5176\u5b9e\u6a21\u5757\u662f\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u6307\u6d3e\u7684\uff0c \u5982\u679c\u60f3\u4ee5\u540e\u4e0d\u9ebb\u70e6\uff0c\u90a3\u4e48\u5c31\u6309\u7167\u4e0b\u9762\u7684\u6a21\u5757\u6307\u6d3e\u5c31\u884c\u4e86\uff0c\u5176\u5b9e\u8fd9\u4e5f\u7b97\u662f\u5168\u80fd\u7684\u4e86\uff0c\u4e0d\u7136\u540e\u671f\u4f60\u9700\u8981\u4ec0\u4e48\u8fd8\u5f97\u91cd\u65b0\u7f16\u8bd1\u8fdb\u53bb\uff0c\u4e0d\u662f\u5f88\u9ebb\u70e6\uff0c\u4f46\u4e5f\u4e0d\u7701\u4e8b\u3002\u81f3\u4e8e\u662f\u5426\u6307\u6d3e\u7528\u6237\u7ec4\uff0c\u6211\u575a\u51b3\u4f1a\u8ba9\u4f60\u6307\u6d3e\uff0c\u8fd9\u53ef\u5173\u4e4enginx\u914d\u7f6e\u7684\u53ef\u7528\u6027\u548c\u5b89\u5168\u7a33\u5b9a\u3002<\/p>\n
\r\n$ .\/configure \\\r\n--prefix=\/usr\/local\/nginx \\\r\n--user=www \\\r\n--group=www \\\r\n--with-pcre \\\r\n--with-openssl=\/tmp\/openssl-1.1.0e \\\r\n--with-http_ssl_module \\\r\n--with-http_v2_module \\\r\n--with-http_realip_module \\\r\n--with-http_addition_module \\\r\n--with-http_sub_module \\\r\n--with-http_dav_module \\\r\n--with-http_flv_module \\\r\n--with-http_mp4_module \\\r\n--with-http_gunzip_module \\\r\n--with-http_gzip_static_module \\\r\n--with-http_random_index_module \\\r\n--with-http_secure_link_module \\\r\n--with-http_stub_status_module \\\r\n--with-http_auth_request_module \\\r\n--with-http_image_filter_module \\\r\n--with-http_slice_module \\\r\n--with-mail \\\r\n--with-threads \\\r\n--with-file-aio \\\r\n--with-stream \\\r\n--with-mail_ssl_module \\\r\n--with-stream_ssl_module \\\r\n<\/pre>\n\r\n$ make -j8 && make install \/\/\u7f16\u8bd1\u5e76\u5b89\u88c5\r\n<\/pre>\n\u521b\u5efa systemctl \u7cfb\u7edf Nginx \u5355\u5143\u6587\u4ef6<\/strong><\/span><\/div>\n\u5b89\u88c5\u5b8c\u6210\u540e\u8fd8\u9700\u8981\u5f00\u673a\u81ea\u542f\u52a8\uff0c\u4e0d\u7136\u6bcf\u6b21\u5f00\u673a\u90fd\u9700\u8981\u624b\u52a8\uff0c\u90a3\u5c82\u4e0d\u662f\u592a\u9ebb\u70e6\u3002<\/p>\n
\r\n$ vim \/usr\/lib\/systemd\/system\/nginx.service\r\n\r\n[Unit]\r\nDescription=The nginx HTTP and reverse proxy server\r\nAfter=syslog.target network.target remote-fs.target nss-lookup.target\r\n\r\n[Service]\r\nType=forking\r\nPIDFile=\/usr\/local\/nginx\/logs\/nginx.pid\r\nExecStartPre=\/usr\/local\/nginx\/sbin\/nginx -t\r\nExecStart=\/usr\/local\/nginx\/sbin\/nginx\r\nExecReload=\/bin\/kill -s HUP \/usr\/local\/nginx\/logs\/nginx.pid\r\nExecStop=\/bin\/kill -s QUIT \/usr\/local\/nginx\/logs\/nginx.pid\r\nPrivateTmp=true\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n\u4fdd\u5b58\u5e76\u9000\u51fa\u3002\r\n<\/pre>\n\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8\u5e76\u542f\u52a8Nginx<\/strong><\/span><\/div>\n\r\n$ systemctl enable nginx.service\r\n$ systemctl restart nginx.service\r\n<\/pre>\n\u8bbe\u7f6eFirewalld\u9632\u706b\u5899<\/strong><\/span><\/div>\n$ firewall-cmd --zone=public --add-port=80\/tcp --permanent\r\n$ firewall-cmd --reload<\/pre>\n\u67e5\u770bNginx\u662f\u5426\u542f\u52a8\u6210\u529f<\/strong><\/span><\/div>\n$ ss -ntlp<\/pre>\n\u53ef\u4ee5\u67e5\u770b\u5230nginx\u8fdb\u7a0b\u5df2\u7ecf\u8fd0\u884c\u4e86\u3002\u5230\u6b64nginx\u5b89\u88c5\u5c31\u5b8c\u6210\u4e86\uff0c\u53ef\u80fd\u4f60\u8fd8\u4f1a\u6709\u7591\u95ee\uff0cnginx\u600e\u4e48\u89e3\u6790\u5e76\u652f\u6301php\u7a0b\u5e8f\u5462\uff0c\u522b\u614c\uff0c\u4e0b\u4e00\u7bc7\u6587\u7ae0\u4e2d\u6211\u4f1a\u5199\u5230\u3002<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/renwole.com\/archives\/39<\/a><\/p>\n