nginx 인증 설정

2023. 6. 10. 22:25Web Server/nginx

HTTP Basic Authentication

https://www.howtogeek.com/devops/how-to-setup-basic-http-authentication-on-nginx/

 

How to Set Up Basic HTTP Authentication in NGINX

Basic username and password authentication is an easy and simple way to secure administrative panels and backend services. Nginx can be configured to protect certain areas of your website, or even used as a reverse proxy to secure other services.

www.howtogeek.com

# 비밀번호 파일 생성
sudo apt-get install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd admin
# 비밀번호 입력

# nginx 설정 변경
location / {
  auth_basic "Restricted Content";
  auth_basic_user_file /etc/nginx/.htpasswd;
}

# nginx 재기동
sudo systemctl restart nginx

'Web Server > nginx' 카테고리의 다른 글

nginx header 정보 제거  (0) 2024.03.01
nginx와 minikube ingress 연동  (0) 2024.02.03
minikube proxy 설정  (0) 2023.06.06
nginx Trouble Shooting  (0) 2023.05.27
nginx 사설 ssl 적용  (0) 2023.05.07