Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help - login with web authentication (nginx) #977

Closed
kiq-moraes opened this issue Aug 19, 2017 · 2 comments
Closed

Help - login with web authentication (nginx) #977

kiq-moraes opened this issue Aug 19, 2017 · 2 comments
Labels

Comments

@kiq-moraes
Copy link

kiq-moraes commented Aug 19, 2017

Hello guys,
I 'm using CENTS 7 running oxidized and I' d like some kind of web authentication, to avoid undue hits.
I tried the following commands below , but the pop window does not appear to enter user and password.
Could someone suggest me something or exemplify how can I do this?

I already created the username and password with:

sudo htpasswd -c /etc/nginx/.htpasswd nginx

in nginx.conf:

 server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;
        auth_basic "Acesso Restrito";
        auth_basic_user_file /etc/nginx/.htpasswd;
        // Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        location / {
        proxy_pass ip:port/;
        //auth_basic "Acesso Restrito";
        //auth_basic_user_file /etc/nginx/.htpasswd;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

Thanks!

Caíque

@danilopopeye
Copy link
Contributor

@kiq-moraes
Copy link
Author

kiq-moraes commented Aug 21, 2017

Hi guys,
I fixed the lines that were wrong and now it's working!
Thank you all.

 server {
        listen ip:port;
        server_name _;
        root         /usr/share/nginx/html;
        // Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        location / {
        auth_basic "Acesso Restrito";
        auth_basic_user_file /etc/nginx/.htpasswd;
        proxy_pass http://127.0.0.1:port/;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants