为iredadmin添加密码保护 - Basic Authentication

现象:将nginx的Basic Authentication配置内容,添加到/etc/nginx/templates/iredadmin.tmpl页头或页尾,不起作用。

尝试:调整位置,可以Basic Authentication的配置内容添加到/etc/nginx/templates/iredadmin.tmpl文件中的python配置里。

如:

# Python scripts
location ~ ^/admin(.*) {                        # <- Changed
    rewrite ^/admin(/.*)$ $1 break;             # <- Changed

    include /etc/nginx/templates/hsts.tmpl;

    include uwsgi_params;
    uwsgi_pass unix:/run/uwsgi/iredadmin.socket;
    uwsgi_param UWSGI_CHDIR /var/www/iredadmin;
    uwsgi_param UWSGI_SCRIPT iredadmin;
    uwsgi_param SCRIPT_NAME /admin;             # <- Changed

    auth_basic           "Administrator’s Area";
    auth_basic_user_file /etc/apache2/.htpasswd; 

    # Access control
    #allow 127.0.0.1;
    #allow 192.168.1.10;
    #allow 192.168.1.0/24;
    #deny all;
}

参考:

标签: iredmail

添加新评论