From 19b5936771033ccf2ac6a1b74ae63f3d7d5c52c0 Mon Sep 17 00:00:00 2001 From: LHearen Date: Fri, 12 Oct 2018 19:40:45 +0800 Subject: [PATCH 1/2] fix some typos and add basic nginx authentication doc --- site/src/site/sphinx/en/web-console.md | 84 ++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/site/src/site/sphinx/en/web-console.md b/site/src/site/sphinx/en/web-console.md index a785da9a0dd..5a7d96f6afe 100644 --- a/site/src/site/sphinx/en/web-console.md +++ b/site/src/site/sphinx/en/web-console.md @@ -1,11 +1,87 @@ Web Console -=== +=========== -Arthas supports the Web Console. After attach success, the user can access: [http://localhost:8563/](http://localhost:8563/). +### Info -The user can fill in the IP and connect the remote arthas on other machines. +Arthas supports Web Console. When being attached successfully, users can access it: [http://localhost:8563/](http://localhost:8563/). + +Users can fill in the IP and connect to the remote Arthas as: ![web console](_static/web-console-local.png) +### Basic Authentication + +We can turn to reversed proxy (Nginx) to add basic authentication to ensure security. This can be easily achieved in Unix/Linux/Mac as follows: + +#### Install apache2-utils + +``` +sudo apt-get install apache2 apache2-doc apache2-utils + +# if it's necessary, update and upgrade repositories +sudo apt-get update && sudo apt-get upgrade +``` + +#### Create some accounts + +``` +sudo htpasswd -c /etc/apache2/.htpasswd user1 + +# you will be prompted to enter the password here + +$ cat /etc/apache2/.htpasswd +user1:$apr1$/woC1jnP$KAh0SsVn5qeSMjTtn0E9Q0 + +# encoded password stored + +# another user, no need to use -c option here again +sudo htpasswd /etc/apache2/.htpasswd user2 +``` + +#### Configure Nginx + +``` +$ cat /etc/nginx/conf.d/arthas.conf + +# after being authenticated, redirected to the proper address +server { + listen 8564; + + auth_basic "Administrator Area"; + auth_basic_user_file /etc/apache2/.htpasswd; + + location / { + proxy_pass http://localhost:8563/; + } +} +``` + +Remember to configure `/etc/nginx/nginx.conf` to include it as + +``` +$ cat /etc/nginx/nginx.conf + +# ... + +http { + # to include the newly added configuration; + include /etc/nginx/conf.d/*.conf; + # ... +} + +``` + +Restart Nginx: `sudo service nginx restart`; if there is anything wrong, please check `tail -f -n 100 /var/log/nginx/error.log`. + +### Test + +``` + +# start Arthas + +$ bin/as.sh +``` + +Access `http://127.0.0.1:8564` now. -If you have suggestions for the Web Console, please leave a message here: [https://github.com/alibaba/arthas/issues/15](https://github.com/alibaba/arthas/issues/15) \ No newline at end of file +If you have suggestions for the Web Console, please leave a message here: [https://github.com/alibaba/arthas/issues/15](https://github.com/alibaba/arthas/issues/15) From 023f33f63ad753382caea3d829213bdd9156d15c Mon Sep 17 00:00:00 2001 From: Hearen Date: Sat, 13 Oct 2018 09:41:30 +0800 Subject: [PATCH 2/2] fix some typos; add comments --- site/src/site/sphinx/en/web-console.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/site/src/site/sphinx/en/web-console.md b/site/src/site/sphinx/en/web-console.md index 5a7d96f6afe..f05aa078abd 100644 --- a/site/src/site/sphinx/en/web-console.md +++ b/site/src/site/sphinx/en/web-console.md @@ -1,17 +1,17 @@ Web Console =========== -### Info +### You should know -Arthas supports Web Console. When being attached successfully, users can access it: [http://localhost:8563/](http://localhost:8563/). +Arthas supports Web Console. When being attached successfully, users can access it at: [http://localhost:8563/](http://localhost:8563/). -Users can fill in the IP and connect to the remote Arthas as: +Users can fill up the IP and port to connect to the remote Arthas as: ![web console](_static/web-console-local.png) ### Basic Authentication -We can turn to reversed proxy (Nginx) to add basic authentication to ensure security. This can be easily achieved in Unix/Linux/Mac as follows: +We can turn to reversed proxy (Nginx) to add basic authentication to ensure security. This can be easily achieved in Unix/Linux/Mac. Take Ubuntu 16.04 as an example: #### Install apache2-utils @@ -26,15 +26,13 @@ sudo apt-get update && sudo apt-get upgrade ``` sudo htpasswd -c /etc/apache2/.htpasswd user1 - # you will be prompted to enter the password here +# encoded password stored $ cat /etc/apache2/.htpasswd user1:$apr1$/woC1jnP$KAh0SsVn5qeSMjTtn0E9Q0 -# encoded password stored - -# another user, no need to use -c option here again +# add another user, no need to use -c option here again sudo htpasswd /etc/apache2/.htpasswd user2 ``` @@ -45,12 +43,14 @@ $ cat /etc/nginx/conf.d/arthas.conf # after being authenticated, redirected to the proper address server { + # testing in the same host, use another port to listen; listen 8564; auth_basic "Administrator Area"; auth_basic_user_file /etc/apache2/.htpasswd; location / { + # after being authenticated, redirect the request to arthas at port: 8563; proxy_pass http://localhost:8563/; } } @@ -68,7 +68,6 @@ http { include /etc/nginx/conf.d/*.conf; # ... } - ``` Restart Nginx: `sudo service nginx restart`; if there is anything wrong, please check `tail -f -n 100 /var/log/nginx/error.log`. @@ -82,6 +81,7 @@ Restart Nginx: `sudo service nginx restart`; if there is anything wrong, please $ bin/as.sh ``` -Access `http://127.0.0.1:8564` now. +Access [http://localhost:8564](http://localhost:8564) now. + If you have suggestions for the Web Console, please leave a message here: [https://github.com/alibaba/arthas/issues/15](https://github.com/alibaba/arthas/issues/15)