Sunday, 26 March 2023

Configure basic authentication in Nginx for Telescope in Laravel

1. Create User/Password for authentication

# Install Apache Utils
sudo apt install apache2-utils
# create user
htpasswd /etc/nginx/conf.d/.htpasswd dev
# case file .htpasswd not exit
htpasswd -c /etc/nginx/conf.d/.htpasswd dev

2. Config nginx for Telescope in Laravel

# open file config
sudo nano /etc/nginx/sites-available/example.com

# config for
telescope
location /telescope {
try_files $uri $uri/ /index.php?$query_string;
auth_basic "dev";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
}

# config for swagger-ui
location /swagger-ui {
try_files $uri $uri/ /index.php?$query_string;
auth_basic "dev";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
}

Thank you.

 

No comments:

Post a Comment

Golang Advanced Interview Q&A