Advertisement
Javi

nginx: tricks and tips

Oct 29th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. # Nginx
  2.  
  3. ## Basic authentication
  4.  
  5. https://www.atlantic.net/uncategorized/configuring-basic-http-authentication-with-nginx-on-ubuntu-22-04/
  6.  
  7. ```sh
  8. sh -c "echo -n 'testuser:' >> /etc/nginx/.htpasswd"
  9. sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
  10. apt install apache2-utils
  11. ```
  12.  
  13. ```
  14. location / {
  15. try_files $uri $uri/ =404;
  16. auth_basic "Basic Authentication";
  17. auth_basic_user_file /etc/nginx/.htpasswd;
  18.  
  19.  
  20. }
  21. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement