{"id":961,"date":"2020-02-05T15:46:14","date_gmt":"2020-02-05T07:46:14","guid":{"rendered":"http:\/\/www.shuran.cn\/?p=961"},"modified":"2020-02-07T18:18:54","modified_gmt":"2020-02-07T10:18:54","slug":"%e4%b8%babt%e9%9d%a2%e6%9d%bf%e7%9a%84nginx%e5%a2%9e%e5%8a%a0webdav%e6%94%af%e6%8c%81","status":"publish","type":"post","link":"https:\/\/www.shuran.cn\/?p=961","title":{"rendered":"\u4e3abt\u9762\u677f\u7684nginx\u589e\u52a0webdav\u652f\u6301"},"content":{"rendered":"\n<p><strong>\u4e00\u3001\u68c0\u67e5NGINX\u7684\u7f16\u8bd1\u53c2\u6570<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -V\n\u8bb0\u5f55\u7ed3\u679c\nnginx version: nginx\/1.17.7\nbuilt by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) \nbuilt with OpenSSL 1.1.1d  10 Sep 2019\nTLS SNI support enabled\nconfigure arguments: --user=www --group=www --prefix=\/www\/server\/nginx --add-module=\/www\/server\/nginx\/src\/ngx_devel_kit --add-module=\/www\/server\/nginx\/src\/lua-nginx-module --add-module=\/www\/server\/nginx\/src\/ngx_cache_purge --add-module=\/www\/server\/nginx\/src\/nginx-sticky-module --with-openssl=\/www\/server\/nginx\/src\/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc <\/code><\/pre>\n\n\n\n<p>\u7528\u8bb0\u4e8b\u672c\u7b49\u6587\u672c\u5de5\u5177\u8bb0\u5f55\u4e0b\u6765\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p><strong>\u4e8c\u3001\u4e0b\u8f7dnginx\u6e90\u7801\uff0c\u4e0b\u8f7d\u5bf9\u5e94\u7684\u53c2\u6570\u3002<br><\/strong>\uff08\u5982\u679c\u4f60\u613f\u610f\uff0c\u53ef\u4ee5\u5728\u9762\u677f\u4e2d\u6267\u884cnginx\u7684\u7248\u672c\u5207\u6362\u547d\u4ee4\uff0c\u6267\u884c\u8fc7\u7a0b\u4e2d\u624b\u52a8\u4e2d\u65ad\uff0c\u627e\u5230bt\u5b98\u65b9\u7684\u5168\u90e8\u6e90\u7801\uff0c\u7406\u8bba\u4e0a\u53ef\u4ee5\u7701\u53bb\u4e86\u4e0b\u8f7d\u5404\u79cd\u63d2\u4ef6\u7684\u8fc7\u7a0b\u3002\uff09<\/p>\n\n\n\n<p>1\u3001\u4e0b\u8f7dnginx<br>\uff08\u4e5f\u53ef\u4ee5\u7528bt\u81ea\u5df1\u7684nginx\u6e90\u7801\uff0c\u8def\u5f84\u662f\/www\/server\/nginx\/src.tar.gz\uff09<br>tar -zxvf  \/www\/server\/nginx\/src.tar.gz  \/www\/server\/nginx\/src<br>cd  \/www\/server\/nginx\/src <br><br>2\u3001\u6309\u7167\u4e0a\u9762\u7684\u914d\u7f6e\u6587\u4ef6\u4e0b\u8f7dmodule\u63d2\u4ef6<br>git clone https:\/\/github.com\/vision5\/ngx_devel_kit.git <br>git clone https:\/\/github.com\/openresty\/lua-nginx-module.git <br>git clone https:\/\/github.com\/FRiCKLE\/ngx_cache_purge.git<br>git clone https:\/\/github.com\/lusis\/nginx-sticky-module.git<br>git clone https:\/\/github.com\/arut\/nginx-dav-ext-module.git<\/p>\n\n\n\n<p><strong>\u6ce8\u610f1\uff1a<br><\/strong>\u7f16\u8bd1\u9700\u8981openssl\u63d2\u4ef6\uff0c\u914d\u7f6e\u6587\u4ef6\u6ca1\u63d0\u793a\uff0c\u9700\u8981\u4e0b\u8f7d\uff0c\u7136\u540e\u6307\u5b9a--with-openssl=\/www\/server\/nginx\/src\/openssl\u7f16\u8bd1\u6761\u4ef6<br>wget https:\/\/www.openssl.org\/source\/openssl-1.1.1d.tar.gz<br>tar -zxvf openssl-1.1.1d.tar.gz  <br>mv openssl-1.1.1d\/ openssl<br>rm -f  openssl-1.1.1d.tar.gz <\/p>\n\n\n\n<p><strong>\u6ce8\u610f2\uff1a<br><\/strong>\u7f16\u8bd1\u4e2d\u9700\u8981pcre-8.43\uff0c\u5426\u5219make\u4e0d\u901a\u8fc7\uff0c\u7136\u540e\u6307\u5b9a--with-pcre=pcre-8.43<br>wget https:\/\/ftp.pcre.org\/pub\/pcre\/pcre-8.43.tar.bz2<br>tar -jxvf pcre-8.43.tar.bz2<\/p>\n\n\n\n<p><strong>\u6ce8\u610f3\uff1a <br><\/strong>lua-nginx-module \u63d2\u4ef6\u5efa\u8bae\u4f7f\u7528\u4f4e\u7248\u672c\uff0c\u5426\u5219\u542f\u52a8nginx\u7684\u65f6\u5019\u6709bug<br>wget https:\/\/github.com\/openresty\/lua-nginx-module\/archive\/v0.10.14.zip<br>unzip v0.10.14.zip lua-nginx-module<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@gao]# tailf \/var\/log\/nginx\/error.log\n# \u95ee\u9898 1 \u6cbf\u7528\u5b98\u65b9\u7684 luajit v2.0.5 \u7f16\u8bd1\u65b0\u7248\u672c lua-nginx-module \u5e94\u8be5\u4f1a\u63d0\u793a\u5efa\u8bae\u5207\u6362\u81f3 openresty \u7684 luajit v2.1 \u5206\u652f\n2019\/11\/04 11:59:56 [alert] 2749#2749: detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https:\/\/github.com\/openresty\/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https:\/\/openresty.org\/en\/download.html)\n\n# \u95ee\u9898 2\uff0c\u89e3\u51b3\u65b9\u6848\u662f\u4f7f\u7528\u4f4e\u7248\u672c lua-nginx-module v0.10.14 \uff0c\u4f7f\u7528\u6700\u65b0\u7248\u53d1\u73b0\u4f1a\u89e6\u53d1\u8be5\u95ee\u9898\uff0c\u7b49\u5f85\u5b98\u65b9\u4fee\u590d\n2019\/11\/04 11:59:56 [alert] 2749#2749: failed to load the 'resty.core' module ( https:\/\/github.com\/openresty\/lua-resty-core); ensure you are using an OpenResty release from https:\/\/openresty.org\/en\/download.html (reason: module 'resty.core' not found:\n\tno field package.preload['resty.core']\n\tno file '.\/resty\/core.lua'\n\tno file '\/usr\/local\/share\/luajit-2.0.5\/resty\/core.lua'\n\tno file '\/usr\/local\/share\/lua\/5.1\/resty\/core.lua'\n\tno file '\/usr\/local\/share\/lua\/5.1\/resty\/core\/init.lua'\n\tno file '.\/resty\/core.so'\n\tno file '\/usr\/local\/lib\/lua\/5.1\/resty\/core.so'\n\tno file '\/usr\/local\/lib\/lua\/5.1\/loadall.so'\n\tno file '.\/resty.so'\n\tno file '\/usr\/local\/lib\/lua\/5.1\/resty.so'\n\tno file '\/usr\/local\/lib\/lua\/5.1\/loadall.so') in \/etc\/nginx\/nginx.conf:117<\/code><\/pre>\n\n\n\n<p><strong>\u6ce8\u610f4\uff1a<br><\/strong>\u5b89\u88c5stick\u6a21\u5757\u51fa\u73b0 MD5_DIGEST_LENGTH \u62a5\u9519<br>\u89e3\u51b3\u65b9\u5f0f\u5c31\u662f\u4fee\u6539\u5728\u4f60\u4e0b\u8f7d\u89e3\u538b\u7f29\u4e4b\u540e\u7684sticky\u6a21\u5757\u6587\u4ef6\u5939\u4e2d\u7684ngx_http_sticky_misc.c\u6587\u4ef6\u5c06\u8fd9\u4e24\u4e2a\u6a21\u5757  openssl\/sha.h  \u4e0e openssl\/md5.h\u5305\u542b\u8fdb\u53bb<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>#include<\/strong> &lt;nginx.h&gt;\n<strong>#include<\/strong> &lt;ngx_config.h&gt;\n<strong>#include<\/strong> &lt;ngx_core.h&gt;\n<strong>#include<\/strong> &lt;ngx_http.h&gt;\n<strong>#include<\/strong> &lt;ngx_md5.h&gt;\n<strong>#include<\/strong> &lt;ngx_sha1.h&gt;\n<strong>#include<\/strong> &lt;openssl\/sha.h&gt;\n<strong>#include<\/strong> &lt;openssl\/md5.h&gt;\n<strong>#include<\/strong> \"ngx_http_sticky_misc.h\"<\/pre>\n\n\n\n<p class=\"has-background has-very-light-gray-background-color\">\u7efc\u5408\u4ee5\u4e0a\uff0c\u6211\u4eec\u5f97\u51fa\u6700\u540e\u7684\u7f16\u8bd1\u53c2\u6570<br> .\/configure --user=www --group=www --prefix=\/www\/server\/nginx --add-module=\/www\/server\/nginx\/src\/ngx_devel_kit --add-module=\/www\/server\/nginx\/src\/lua-nginx-module --add-module=\/www\/server\/nginx\/src\/ngx_cache_purge --add-module=\/www\/server\/nginx\/src\/nginx-sticky-module --with-openssl=\/www\/server\/nginx\/src\/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --add-module=nginx-dav-ext-module --with-http_dav_module <\/p>\n\n\n\n<p><strong>\u4e09\u3001\u7f16\u8bd1\u8fc7\u7a0b\u4e5f\u4e0d\u5bb9\u6613<br><\/strong>1\u3001\u6267\u884c\u914d\u7f6e\u53c2\u6570\u62a5\u9519\uff0c\u7f3a\u5c11luajit\u652f\u6301\u3002\u90a3\u4e48<br>git clone https:\/\/github.com\/openresty\/luajit2.git<br>cd luajit2<br>make<br>make install<br>cd src<br>cp luajit \/usr\/local\/bin\/<br>export LUAJIT_LIB=\/usr\/local\/lib<br>export  LUAJIT_INC=\/usr\/local\/include\/luajit-2.1<\/p>\n\n\n\n<p><strong>\u6ce8\u610f5\uff1a<br><\/strong>luajit\u7684\u4e0b\u8f7d\u5730\u5740\uff0c\u5fc5\u987b\u662fopenresty\u7684\u5206\u652f\uff0c\u4e0d\u80fd\u662forg\u5b98\u65b9\u5206\u652f\uff0c\u5426\u5219\u62a5\u9519<br>nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https:\/\/github.com\/openresty\/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https:\/\/openresty.org\/en\/download.html)<\/p>\n\n\n\n<p>2\u3001\u7ee7\u7eed\u7f16\u8bd1\uff0c\u57fa\u672c\u5c31\u80fd\u901a\u8fc7\u4e86<\/p>\n\n\n\n<p>3\u3001make\uff0c\u5176\u4e2d\u6ce8\u610f4\u4e0e\u6ce8\u610f2\u5c31\u662f\u6211\u7ecf\u5386\u7684\u62a5\u9519<\/p>\n\n\n\n<p>4\u3001\u62f7\u8d1d\u65e7\u7684nginx\u505a\u5907\u4efd\u3002\u5c06\u65b0\u7684nginx\u632a\u8fdb\u53bb<br> mv \/www\/server\/nginx\/sbin\/nginx \/www\/server\/nginx\/sbin\/nginx.old<br> cp objs\/nginx \/www\/server\/nginx\/sbin\/nginx <\/p>\n\n\n\n<p><strong>\u56db\u3001\u914d\u7f6ewebdav<\/strong><br>1\u3001bt\u9762\u677f\u4e2d\u5efa\u7acb\u7ad9\u70b9\u3002<br>2\u3001\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u589e\u52a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/ {\n        charset utf-8;\n        autoindex on;\n        dav_methods PUT DELETE MKCOL COPY MOVE;\n        dav_ext_methods PROPFIND OPTIONS  LOCK UNLOCK PROPPATCH;\n        create_full_put_path  on;\n        dav_access user:rw group:r all:r;\n        auth_basic \"Authorized Users Only\";\n        auth_basic_user_file \/www\/wwwroot\/bt\/.htpasswd;\n    }<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\"><strong>\u6ce8\u610f6\uff1a<\/strong><br>dav_ext_methods  \u4e2d\u7684 PROPPATCH \u8fd9\u4e2a response\u00a0 \uff0c\u9700\u8981\u6253\u8865\u4e01\u5e76\u91cd\u65b0\u7f16\u8bd1.<br>\u8865\u4e01\u5730\u5740<br><a href=\"https:\/\/github.com\/arut\/nginx-dav-ext-module\/files\/3835180\/proppatch.patch.gz\">https:\/\/github.com\/arut\/nginx-dav-ext-module\/files\/3835180\/proppatch.patch.gz<\/a><br>\u63cf\u8ff0\u5730\u5740\uff1a <a href=\"https:\/\/github.com\/arut\/nginx-dav-ext-module\/issues\/52\">https:\/\/github.com\/arut\/nginx-dav-ext-module\/issues\/52<\/a> <br>\u636e\u8bf4\u5f00\u542f\u4ee5\u540e\u53ef\u4ee5\u652f\u6301windows\u7684\u81ea\u5e26webdav\u5ba2\u6237\u7aef\u5199\u5165\u3002---\u6211\u6d4b\u8bd5\u5931\u8d25\u4e86\u3002<\/p>\n\n\n\n<p>3\u3001\u586b\u5751\uff0c\u7528\u6237\u6587\u4ef6.htpasswd\u600e\u4e48\u751f\u6210\uff1f\u7ecf\u67e5\uff0c\u5fc5\u987b\u5b89\u88c5apache\u624d\u80fd\u5f97\u5230htpasswd\u547d\u4ee4\uff0c\u6240\u4ee5\u6e90\u7801\u7f16\u8bd1\uff0cmake\u540e\u62f7\u8d1d\u51fa\u6765\u800c\u4e0d\u5b89\u88c5\u884c\u4e48\uff1f\u52a8\u624b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/www-eu.apache.org\/dist\/httpd\/httpd-2.4.41.tar.gz\ntar -zxvf httpd-2.4.41.tar.gz \ncd httpd-2.4.41\n.\/configure \n.....\n\n\u60b2\u5267\uff0c\u7f3a\u5c11apr<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>wget http:\/\/mirror.bit.edu.cn\/apache\/\/apr\/apr-1.7.0.tar.gz\ntar -zxvf apr-1.7.0.tar.gz \ncd apr-1.7.0\n.\/configure \nmake &amp;&amp; make install\n\nwget http:\/\/mirror.bit.edu.cn\/apache\/\/apr\/apr-util-1.6.1.tar.gz\ntar -zxvf apr-util-1.6.1.tar.gz\n.\/configure --with-apr=\/usr\/local\/apr\nmake &amp;&amp; make install<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u7ee7\u7eed\u6267\u884cHTTPD\u7684\u7f16\u8bd1\n.\/configure\nmake\ncp .\/support\/htpasswd \/usr\/local\/bin\/\n\u4e8e\u662f\u5f97\u5230\u4e86htpasswd!!!<\/code><\/pre>\n\n\n\n<p>htpasswd -c \/www\/wwwroot\/bt\/.htpasswd www<br>\u540e\u9762\u7684www\u4e3a\u4f60\u8981\u5efa\u7acb\u7684\u7528\u6237\u540d\uff0c\u7d27\u63a5\u7740\u8f93\u5165\u5bc6\u7801\uff0c\u5b8c\u4e8b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u68c0\u67e5NGINX\u7684\u7f16\u8bd1\u53c2\u6570 \u7528\u8bb0\u4e8b\u672c\u7b49\u6587\u672c\u5de5\u5177\u8bb0\u5f55\u4e0b\u6765\u914d\u7f6e\u6587\u4ef6 \u4e8c\u3001\u4e0b\u8f7dnginx\u6e90\u7801\uff0c\u4e0b\u8f7d\u5bf9\u5e94\u7684\u53c2\u6570\u3002\uff08\u5982\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.shuran.cn\/?p=961\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-961","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=961"}],"version-history":[{"count":3,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/961\/revisions"}],"predecessor-version":[{"id":965,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=\/wp\/v2\/posts\/961\/revisions\/965"}],"wp:attachment":[{"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuran.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}