Password protected?
https://ubiq.co/tech-blog/how-to-password-protect-directory-in-nginx/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm looking at an appropriate way to protect a directory within our laravel application.
The files are currently being generated by scribe, and outputs a directory full of html and css files into public/docs/
What I'd like to do is to protect that route so that it can only be accessed if config('app.env') !='live'
Can someone point me to the best way to deal with this. I would suspect I'd be better to render the directory outside of the public directory and then add a route with a config check to allow me to render the directory?
@automica can't you just set the directory to deny all on the production server? Or allow specific ips in the same way
location /docs { deny all; }
Please or to participate in this conversation.