![](/img/trans.png)
[英]How to free up space on AWS ec2 Ubuntu instance running nginx and jenkins?
[英]Set up Supervisord Web Gui Dashboard to Be Accessible Remotely on Ubuntu AWS EC2 Instance with NGINX
我的目標:我正在使用運行Ubuntu的AWS EC2實例。 我正在使用supervisord來啟動和監視我長時間運行的進程,我想使用內置的Web GUI儀表板來監視我長時間運行的進程。
我的堅持點:我可以找到關於如何設置它的說明,但我無法找到如何在ec2實例上設置它。 我目前只能通過ssh命令行訪問我的AWS ec2實例。 我希望能夠通過筆記本電腦上辦公室的瀏覽器查看儀表板。
我的印象是我需要配置nginx來“服務”這個gui狀態頁面。
我的/etc/nginx/sites-available/supervisord
文件:
server {
location / supervisord/ {
proxy_pass http://127.0.0.1:9001/;
proxy_http_version 1.1;
proxy_buffering off;
proxy_max_temp_file_size 0;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
}
}
我的猜測是我可以將http://127.0.0.1:9001更改為我實際服務器的IPV4地址。 我知道我的服務器在端口9001上有tcp監聽器。通過netstat -tulpn | grep LISTEN
的結果 netstat -tulpn | grep LISTEN
tcp 0 0 127.0.0.1:9001 0.0.0.0:* LISTEN -
我的/etc/supervisord.conf
文件:
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ;
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=debug ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
nocleanup=true ; (don't clean up tempfiles at start;default false)
childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
;serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
; The below sample program section shows all possible program subsection values,
; create one or more 'real' program: sections to be able to control them under
; supervisor.
[program:my_program]
command=my_program.py ; the program (relative uses PATH, can take args)
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)
autostart=true ; start at supervisord start (default: true)
startsecs=3 ; # of secs prog must stay up to be running (def. 1)
當我curl http://127.0.0.1:9001
我將整個index.html頁面作為主管GUI的文本返回給我。
我知道:1。服務已啟動2.端口9001已打開,並且有一個服務偵聽該端口。
我不知道:1。如何從我的筆記本電腦在瀏覽器中找到它:(
我終於搞清楚了。
使用安全組打開ec2實例的端口80和443。 首先確定你的ec2實例所在的安全組。在你的ec2儀表板中,如果選擇你的ec2實例,你將能夠看到它在同一行中的安全組,你可能需要向右滾動才能看到它。 轉到安全組儀表板並選擇您的安全組。 將它設置為這樣的東西,你可以在以后使它更具限制性,這只是為了讓它繼續下去:
制作這個/etc/nginx/sites-available/supervisord
文件:
upstream supervisord {
server localhost:9001 fail_timeout=0;
}
server {
listen 80;
server_name ec2-**-***-**-**.compute-1.amazonaws.com;
access_log /var/log/access_supervisor.log;
error_log /var/log/error_supervisor.log;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://supervisord;
}
}
好的,所以我有server_name ec2-**-***-**-**.compute-1.amazonaws.com;
您需要放置您的公共DNS(IPV4)。 如果您轉到ec2儀表板並選擇您的實例,您將在屏幕底部看到一個“描述”選項卡,您可以在其中獲取此信息。 我把*放在這里以免暴露我的,但你會把實際的數字放在那里,而不是星號。
sudo ln -s /etc/nginx/sites-available/supervisord /etc/nginx/sites-enable/supervisord
sudo nginx -s reload
參考: https : //www.dangtrinh.com/2013/11/supervisord-using-built-in-web.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.