Skip to content

Instantly share code, notes, and snippets.

@murachi1208
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save murachi1208/32a7e0c3f90264c6780c to your computer and use it in GitHub Desktop.
Save murachi1208/32a7e0c3f90264c6780c to your computer and use it in GitHub Desktop.
Nginx で WebDAV 環境構築、PROPFIND 405 が使えなかったのでソースからコンパイルしてみた ref: http://qiita.com/murachi1208/items/a67ae7b617d459e04615
192.168.11.1 - - [05/May/2015:08:40:23 +0900] "OPTIONS / HTTP/1.1" 405 166 "-" "Rei.Fs.WebDAV/1.11.12
$ sudo yum install expat-devel
$ sudo yum install wget gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel gd gd-devel
$ wget http://nginx.org/download/nginx-1.9.0.tar.gz
$ tar zxvf nginx-1.9.0.tar.gz
$ cd nginx-1.9.0
$ git clone https://github.com/arut/nginx-dav-ext-module.git
$ cd nginx-1.9.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=/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-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --add-module=./nginx-dav-ext-module
$ make
$ sudo make install
$ sudo useradd -s/sbin/nologin -d/usr/local/nginx -M nginx
# cd /etc/init.d
# wget -O nginx "http://wiki.nginx.org/index.php?title=RedHatNginxInitScript&action=raw&anchor=nginx"
# chmod +x nginx
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
server {
listen 8888;
server_name localhost;
location / {
root /tmp;
# デフォルトのキャラクターコード
charset utf-8;
# ブラウザから確認するとき
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
# アップロードサイズの上限
client_max_body_size 100m;
# WebDAV設定
dav_methods PUT DELETE MKCOL COPY MOVE;
# nginx-dav-ext-module の拡張メソッド
dav_ext_methods PROPFIND OPTIONS;
# WebDAVでのアクセス権を設定
dav_access group:r all:r;
client_body_temp_path /tmp;
create_full_put_path on;
access_log /var/log/nginx/webdav.access.log;
error_log /var/log/nginx/webdav.error.log;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment