• Suse linux 11 SP2 nginx 使用笔记


    1. 下载源代码
     
    2. DAV模块缺省没有编译,要加入编译选项
    # ./configure --with-http_dav_module
     
    # make install
     
    # cd /usr/local/nginx/sbin
     
    # ./nginx
     
    # ps -ef | grep nginx
     
    # ps -ef | grep nginx
    root      7330     1  0 22:46 ?        00:00:00 nginx: master process ./nginx
    nobody    7331  7330  0 22:46 ?        00:00:00 nginx: worker process
     
    # ./nginx -h
    nginx version: nginx/1.4.2
    Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

    Options:
      -?,-h         : this help
      -v            : show version and exit
      -V            : show version and configure options then exit
      -t            : test configuration and exit
      -q            : suppress non-error messages during configuration testing
      -s signal     : send signal to a master process: stop, quit, reopen, reload
      -p prefix     : set prefix path (default: /usr/local/nginx/)
      -c filename   : set configuration file (default: conf/nginx.conf)
      -g directives : set global directives out of configuration file
     
     
    2. WebDav设置
    nginx的缺省html目录/usr/local/nginx/html, 为了以后的WebDav测试,先简单将权限设置为777
    # chmod 777 /usr/local/nginx/html
     
    nignx 源代码不包含digest认证模块
     
    下载digest模块并解压到目录nginx-http-auth-digest-master
     
    # ./configure --with-http_dav_module  --add-module=nginx-http-auth-digest-master
     
    nginx WebDav的配置: (http://wiki.nginx.org/HttpDavModule)
    修改/usr/local/nginx/conf/nginx.conf
     
    location / {
                root   html;
                index  index.html index.htm;
                dav_methods  PUT DELETE MKCOL COPY MOVE;

                create_full_put_path   on;
                dav_access                all:rw;
            }
     
    用curl测试上传:curl -T test.txt http://127.0.0.1/test.txt
     
     
    nginx digest认证的配置:
     
    创建密码文件:
    # htdigest2 -c /usr/local/nginx/conf/webdav.passwd WebDAV-Realm steve
    Adding password for steve in realm WebDAV-Realm.
    New password:
    Re-type new password: 
     
    修改/usr/local/nginx/conf/nginx.conf
    auth_digest_user_file /usr/local/nginx/conf/webdav.passwd;
            auth_digest_shm_size 4m;   # the storage space allocated for tracking active sessions

            location / {
                root   html;
                index  index.html index.htm;
                dav_methods  PUT DELETE MKCOL COPY MOVE;

                create_full_put_path   on;
                dav_access             all:rw;

                auth_digest 'WebDAV-Realm'; # realm name
                auth_digest_timeout 60s; # allow users to wait 1 minute between receiving the
                                         # challenge and hitting send in the browser dialog box
                auth_digest_expires 10s; # after a successful challenge/response, let the client
                                         # continue to use the same nonce for additional requests
                                         # for 10 seconds before generating a new challenge
                 auth_digest_replays 20; # also generate a new challenge if the client uses the
                                         # same nonce more than 20 times before the expire time limit
            }
     
    再用curl上传(没有用户名和密码)会失败
    # curl -T test.txt http://127.0.0.1/test.txt
  • 相关阅读:
    大并发服务器框架设计
    Flask框架(五) —— session源码分析
    Flask框架(三)—— 请求扩展、中间件、蓝图、session源码分析
    Flask框架(二)—— 反向解析、配置信息、路由系统、模板、请求响应、闪现、session
    Flask框架(一)—— Flask简介
    celery执行异步任务和定时任务
    爬虫(五)—— selenium模块启动浏览器自动化测试
    爬虫(四)—— 使用pyecharts展示数据
    爬虫(三)—— BeautifulSoup模块获取元素
    数据库(三)—— 数据库存储引擎、日志、备份、主从复制、高可用架构
  • 原文地址:https://www.cnblogs.com/huidaoli/p/3727054.html
Copyright © 2020-2023  润新知