{"id":324,"date":"2018-03-13T00:00:53","date_gmt":"2018-03-12T16:00:53","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=324"},"modified":"2018-03-13T00:00:53","modified_gmt":"2018-03-12T16:00:53","slug":"debian-os-rebuild-nginx-deb-package","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/debian-os-rebuild-nginx-deb-package.html","title":{"rendered":"Debian\u7cfb\u7edf\u91cd\u65b0\u6253\u5305nginx\u683c\u5f0fdeb\u8f6f\u4ef6\u5305"},"content":{"rendered":"<p>\u56e0\u4e3a\u67d0\u4e9b\u539f\u56e0\uff0c\u6211\u9700\u8981\u4f7f\u7528Nginx\u7684\u67d0\u4e2a\u6a21\u5757\uff0c\u4f46\u662f\u8981\u7528\u7684\u90a3\u4e2a\u6a21\u5757\u6b63\u597dNginx\u4e0d\u81ea\u5e26\uff0c\u4e8e\u662f\u6211\u4eec\u9700\u8981\u81ea\u5df1\u52a0\u4e0a\u5bf9\u5e94\u7684\u67d0\u4e2a\u6a21\u5757\u4e4b\u540e\u518d\u6b21\u7f16\u8bd1Nginx\u3002<br \/>\n\u4f46\u662f\u6211\u53c8\u4e0d\u60f3\u5230\u6b63\u5f0f\u7684\u670d\u52a1\u5668\u4e0a\u53bb\u5b89\u88c5\u7f16\u8bd1\u6240\u9700\u8981\u7684\u90a3\u4e00\u5927\u5806\u4f9d\u8d56\uff0c\u4e8e\u662f\u5c31\u60f3\u7740\u80fd\u5426\u501f\u52a9Nginx\u5b98\u65b9\u7684\u4ee3\u7801\u3001\u76f8\u5173\u7f16\u8bd1\u7a0b\u5e8f\u518d\u6b21\u81ea\u884c\u4e8c\u6b21\u6253\u5305\uff0c\u6298\u817e\u4e86\u4e00\u4e0b\uff0c\u8fd8\u771f\u88ab\u6211\u6253\u5305\u6210\u529f\u4e86\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\u3002<br \/>\n<!--more--><br \/>\n\u6211\u8fd9\u6b21\u662f\u5728Debian9\u4e0a\u64cd\u4f5c\u7684\uff0c\u4f46\u662f\u8bb2\u9053\u7406\uff0c\u4ece\u6211\u4e4b\u524d\u7684\u6253\u5305\u8fc7\u7a0b\u6765\u8bf4\uff0cDebian8\u4e5f\u662f\u4e00\u6837\u80fd\u7528\u7684\uff0c\u6574\u4e2a\u6253\u5305\u6b65\u9aa4\uff0c\u548c\u7cfb\u7edf\u51e0\u4e4e\u6ca1\u4ec0\u4e48\u5173\u7cfb\uff0c\u6240\u4ee5\u7cfb\u7edf\u662fDebian9\u8fd8\u662fDebian8\u90fd\u65e0\u6240\u8c13\u4e86\uff0c\u5f53\u7136\uff0c\u6211\u6ca1\u5728Debian7\u4e0a\u8bd5\u8fc7\u3002<\/p>\n<h2>\u6dfb\u52a0Nginx\u5b98\u65b9\u6e90<\/h2>\n<p>\u9996\u5148\uff0c\u9700\u8981\u6dfb\u52a0Nginx\u5b98\u65b9\u5b98\u65b9\u6e90\u4ed3\u5e93\uff0c\u5982\u679c\u6ca1\u6709\u6dfb\u52a0\u7684\uff0c\u53ef\u4ee5\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\u5148\u884c\u6dfb\u52a0\u518d\u64cd\u4f5c\uff1a<a href=\"https:\/\/cloudbool.com\/archive\/post\/linux-install-official-repo-nginx.html\">Linux\u5b89\u88c5\u5b98\u65b9\u6700\u65b0\u7248\u7684Nginx<\/a>\u3002<\/p>\n<h2>\u5b89\u88c5\u7f16\u8bd1\u73af\u5883\u6240\u9700\u8981\u7684\u4f9d\u8d56<\/h2>\n<p>\u8981\u7f16\u8bd1\u80af\u5b9a\u9700\u8981\u6709\u7f16\u8bd1\u73af\u5883\u652f\u6301\u4e86\uff0c\u4e00\u884c\u547d\u4ee4\u5b89\u88c5\u7f16\u8bd1\u73af\u5883\uff1a<\/p>\n<pre><code class=\"bash\">apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev git\n<\/code><\/pre>\n<h2>\u4e0b\u8f7dNginx\u6e90\u4ee3\u7801\u53ca\u76f8\u5173\u6253\u5305\u9700\u8981\u7684\u6587\u4ef6<\/h2>\n<p>\u6267\u884c\u4e0b\u9762\u51e0\u6b65\uff1a<\/p>\n<pre><code>cd ~\nmkdir -p ~\/new\/nginx_rebulid\/ #\u521b\u5efa\u65b0\u76ee\u5f55  \u7528\u4e8e\u4fdd\u5b58\u6211\u4eec\u6240\u8981\u4f7f\u7528\u7684\u6587\u4ef6\ncd ~\/new\/nginx_rebulid\/\napt-get source nginx #\u4e0b\u8f7dNginx\u6e90\u4ee3\u7801\napt-get build-dep nginx  #\u5b89\u88c5\u7f16\u8bd1Nginx\u6240\u9700\u8981\u7684\u4f9d\u8d56\n<\/code><\/pre>\n<h2>\u51c6\u5907\u6211\u4eec\u6240\u9700\u8981\u7684\u6a21\u5757<\/h2>\n<p>\u91cd\u65b0\u6253\u5305\u7f16\u8bd1\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u884c\u51c6\u5907\u6211\u4eec\u6240\u9700\u8981\u7684\u6a21\u5757\uff0c\u6bd4\u5982\u8bf4<a href=\"https:\/\/github.com\/cuber\/ngx_http_google_filter_module\">Nginx Module for Google<\/a>\uff0c\u55ef\uff0c\u4f60\u61c2\u7684\u3002<br \/>\n\u4ee5\u4e0b\u662f\u6211\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<pre><code>cd \/usr\/local\/src\ngit clone https:\/\/github.com\/cuber\/ngx_http_google_filter_module\ngit clone https:\/\/github.com\/yaoweibin\/ngx_http_substitutions_filter_module\n<\/code><\/pre>\n<p>\u9664\u4e86\u8fd9\u4e2a\u6a21\u5757\uff0c\u4f60\u4e5f\u80fd\u4f7f\u7528\u522b\u7684\u6a21\u5757\uff0c\u53ea\u9700\u8981\u786e\u5b9a\u597d\u6a21\u5757\u6240\u5b58\u653e\u7684\u76ee\u5f55\u5373\u53ef\uff0c\u4e0b\u9762\u5c31\u4f1a\u7528\u5230\u3002<\/p>\n<h2>\u4fee\u6539\u6253\u5305\u89c4\u5219<\/h2>\n<p>\u8981\u91cd\u65b0\u6253\u5305\uff0c\u6211\u4eec\u80af\u5b9a\u9700\u8981\u4fee\u6539\u5b98\u65b9\u539f\u6709\u7684\u6253\u5305\u89c4\u5219\u4e86\uff0c\u4ee5\u4e0b\u662f\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<pre><code>cd ~\/new\/nginx_rebulid\/nginx-{nginx\u7248\u672c\u53f7}\/debin\/\nvim rules\n<\/code><\/pre>\n<p>\u5efa\u8bae\u5907\u4efd\u4e0a\u8ff0\u6587\u4ef6\uff0c\u7136\u540e\u4fee\u6539\u5982\u4e0b\u8fd9\u90e8\u5206\uff1a<\/p>\n<pre><code>config.status.nginx: config.env.nginx\n        cd $(BUILDDIR_nginx) &amp;&amp; \\\n        CFLAGS=\"\" .\/configure --prefix=\/etc\/nginx --sbin-path=\/usr\/sbin\/nginx --modules-path=\/usr\/lib\/nginx\/modules --conf-path=\/etc\/nginx\/nginx.conf --error-log-path=\/var\/log\/nginx\/error.log --http-log-path=\/var\/log\/nginx\/access.log --pid-path=\/var\/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=www --group=www --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-cc-opt=\"$(CFLAGS)\" --with-ld-opt=\"$(LDFLAGS)\" --add-module=\/usr\/local\/src\/ngx_http_google_filter_module --add-module=\/usr\/local\/src\/ngx_http_substitutions_filter_module --add-module=\/usr\/local\/src\/ngx_cache_purge\n        touch $@\nconfig.status.nginx_debug: config.env.nginx_debug\n        cd $(BUILDDIR_nginx_debug) &amp;&amp; \\\n        CFLAGS=\"\" .\/configure --prefix=\/etc\/nginx --sbin-path=\/usr\/sbin\/nginx --modules-path=\/usr\/lib\/nginx\/modules --conf-path=\/etc\/nginx\/nginx.conf --error-log-path=\/var\/log\/nginx\/error.log --http-log-path=\/var\/log\/nginx\/access.log --pid-path=\/var\/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=www --group=www --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-cc-opt=\"$(CFLAGS)\" --with-ld-opt=\"$(LDFLAGS)\" --with-debug --add-module=\/usr\/local\/src\/ngx_http_google_filter_module --add-module=\/usr\/local\/src\/ngx_http_substitutions_filter_module --add-module=\/usr\/local\/src\/ngx_cache_purge\n<\/code><\/pre>\n<p>\u53c2\u7167\u539f\u6709\u7684\u5199\u6cd5\uff0c\u5728\u540e\u9762\u52a0\u4e0a\u6211\u4eec\u6240\u9700\u8981\u7f16\u8bd1\u8fdb\u53bb\u7684\u6a21\u5757\uff0c\u7136\u540e\u4fdd\u5b58\u9000\u51fa\u3002<\/p>\n<h2>\u91cd\u65b0\u6253\u5305\u7f16\u8bd1Nginx<\/h2>\n<p>\u4fee\u6539\u4e4b\u540e\u6211\u4eec\u5c31\u53ef\u4ee5\u91cd\u65b0\u6253\u5305\u4e86\uff0c\u4ee5\u4e0b\u662f\u547d\u4ee4\uff1a<\/p>\n<pre><code>cd ~\/new\/nginx_rebulid\/nginx-{nginx\u7248\u672c\u53f7}\/\ndpkg-buildpackage -b\n<\/code><\/pre>\n<p>\u4e00\u4e32\u4e32\u5b57\u7b26\u4e32\u6eda\u8fc7\u4e4b\u540e\uff0c\u5982\u679c\u6ca1\u6709\u62a5\u9519\uff0c\u6211\u4eec\u7684Nginx\u5e94\u8be5\u662f\u7f16\u8bd1\u597d\u4e86\u3002<br \/>\n\u7f16\u8bd1\u597d\u7684Nginx\u5b89\u88c5\u5305\u5728<strong>~\/new\/nginx_rebuild<\/strong>\uff0c\u540d\u5b57\u4ee5nginx\u5f00\u59cb\uff0c\u4ee5.deb\u7ed3\u5c3e\u3002<br \/>\n\u7136\u540e\u5728\u672c\u673a\u6216\u8005\u62f7\u8d1d\u5230\u522b\u7684\u673a\u5668\uff0c\u7528\u5982\u4e0b\u547d\u4ee4\u5c31\u53ef\u4ee5\u5b89\u88c5\u4e86\uff1a<\/p>\n<pre><code>dpkg -i nginx_1.12.2-1~stretch_amd64.deb\n<\/code><\/pre>\n<p>\u5b89\u88c5\u4e4b\u540e\u5c31\u80fd\u770b\u5230\u6211\u4eec\u6240\u9700\u8981\u7684\u6a21\u5757\uff0c\u67e5\u770b\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre><code>root@BWH123:~\/new\/nginx_source# nginx -V\nnginx version: nginx\/1.12.2\nbuilt by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)\nbuilt with OpenSSL 1.1.0f  25 May 2017\nTLS SNI support enabled\nconfigure arguments: --prefix=\/etc\/nginx --sbin-path=\/usr\/sbin\/nginx --modules-path=\/usr\/lib\/nginx\/modules --conf-path=\/etc\/nginx\/nginx.conf --error-log-path=\/var\/log\/nginx\/error.log --http-log-path=\/var\/log\/nginx\/access.log --pid-path=\/var\/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-cc-opt='-g -O2 -fdebug-prefix-map=\/root\/new\/nginx_source\/nginx-1.12.2=. -specs=\/usr\/share\/dpkg\/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=\/usr\/share\/dpkg\/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie' --add-module=\/usr\/local\/src\/ngx_http_google_filter_module --add-module=\/usr\/local\/src\/ngx_http_substitutions_filter_module --add-module=\/usr\/local\/src\/ngx_cache_purge\n<\/code><\/pre>\n<p>\u540e\u9762\u5df2\u7ecf\u6709\u6211\u4eec\u6240\u9700\u8981\u7684\u6a21\u5757\u4e86\uff0c\u8bf4\u660e\u4e8c\u6b21\u6253\u5305\u5df2\u7ecf\u6210\u529f\u4e86\u3002<br \/>\n\u53c2\u8003\u6587\u7ae0\uff1ahttps:\/\/linux.cn\/article-5707-1.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u4e3a\u67d0\u4e9b\u539f\u56e0\uff0c\u6211\u9700\u8981\u4f7f\u7528Nginx\u7684\u67d0\u4e2a\u6a21\u5757\uff0c\u4f46\u662f\u8981\u7528\u7684\u90a3\u4e2a\u6a21\u5757\u6b63\u597dNginx\u4e0d\u81ea\u5e26\uff0c\u4e8e\u662f\u6211\u4eec\u9700\u8981\u81ea\u5df1\u52a0\u4e0a\u5bf9\u5e94 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/debian-os-rebuild-nginx-deb-package.html\"> <span class=\"screen-reader-text\">Debian\u7cfb\u7edf\u91cd\u65b0\u6253\u5305nginx\u683c\u5f0fdeb\u8f6f\u4ef6\u5305<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[182],"tags":[27,76],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry","category-linux","tag-debian","tag-nginx"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/324\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}