Welcome! Log In Create A New Profile

Advanced

Automation of basic authentication?

Posted by mattice 
Automation of basic authentication?
July 07, 2009 06:26AM
Hello,

In Apache users can protect their own directories as they see fit.
They just upload a .htaccess and .htpasswd and it works.

I know how to protect a directory in the configuration file of Nginx, but is it possible (one way or the other) to have something similar as Apache does? So my users can protect / unprotect their directories through FTP - without me having to change the configuration and restart Nginx?

I wonder how other people that use Nginx for Virtual Hosting solve this problem?

Thanks!
Re: Automation of basic authentication?
July 07, 2009 02:25PM
It has to be done through reloading a configuration or re-setting file permissions accordingly.

It may be possible to have nginx proxy to another instance on nginx listening on a different port for each vhost (say UID +8000) . Then each user can have an "included" config file and trigger their own reloads. I've never tried it so it may not be possible as I know nginx likes to run as root.

I am curious how you are managing with nginx in a shared hosting environment. I use it for servers that are running my own sites but I am still stuck on cPanel in my shared hosting business. I have too many accounts being created to not use an automated system (I use WHMCS). If someone would write an nginx plugin for cPanel I would be thrilled.

--
Jim Ohlstein
Re: Automation of basic authentication?
July 07, 2009 03:11PM
Thanks for the heads up. Automagic rebuilding of the configs it is then,,.

Is there are specific reason the authors did not code any logic for this?
I assume speed - but it would be nice to have something (imo) elementary as this in Nginx.

We started out using Nginx as a proxy for static files in front of Apache but slowly are migrating everything.
Hence why the question came up - it is tedious to do this by hand for all customers every time they need a change.

As our main platform is OpenBSD we are used to the commandline - controlpanels are not an option nor desired.
So automation is pretty much done through a few custom scripts, some with a database backend.
Re: Automation of basic authentication?
July 07, 2009 03:17PM
I understand. I don't use a control panel for any of my personal servers either but my customers *need* them. :p

You answered your own question. Speed. I don't think nginx will ever support scanning for an .htaccess type of file for that very reason. If someone wanted to custom code it I suppose that they could but it would slow things down immensely and pretty much defeat the purpose.

--
Jim Ohlstein
Re: Automation of basic authentication?
July 07, 2009 03:37PM
I understand complete ht-logic with scanning like Apache has is undesired overkill.
But just for authentication something like a structured file that lives in the site root and holds the relative paths and user/pass combo's could work - or so it seems with my limited knowledge on the subject.
Re: Automation of basic authentication?
July 07, 2009 04:04PM
mattice Wrote:
-------------------------------------------------------
>or so it seems with my limited
> knowledge on the subject.

You probably know more than I.

You can add it as a separate request at http://wiki.nginx.org/NginxFeatureRequests but I wouldn't hold my breath waiting for it.

--
Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 114
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready