nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 324 forks source link

Does nginx unit support auth_basic for routes #1052

Closed umlumpa closed 6 months ago

umlumpa commented 6 months ago

          location / {
            root /var/www/html/src/frontend/web;
            try_files $uri /index.php$is_args$args;
            auth_basic "Restricted Access";
            auth_basic_user_file /etc/nginx/auth;
          }
          location ~* ^.+\.(jpg|jpeg|gif|png|svg|ico|pdf|ppt|txt|bmp|rtf|woff|woff2|ttf|eot)$ {
            root /var/www/html/src/frontend/web;
            expires 14d;
          }
          location /robots.txt {
            auth_basic "off";
          }
          location ~ ^/.+\.php(/|$) {
            fastcgi_pass localhost:9000;

            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            include fastcgi_params;

            fastcgi_param SCRIPT_FILENAME /var/www/html/src/frontend/web$fastcgi_script_name;
            fastcgi_param HTTPS off;
          }
        }
``` how  it will be in unit conf?