bash
# 支持下载功能
location /download{
alias /data/batch_create_inspect_reports/inspection_data_report;
fancyindex on; #启用 fancy 索引
fancyindex_exact_size off; #输出人类可读的文件大小
autoindex on; #开启目录浏览
autoindex_format html; #以html风格将目录展示在浏览器中
autoindex_exact_size off; #切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB
autoindex_localtime on; #以服务器的文件时间作为显示的时间
charset utf-8,gbk; #展示中文文件名
在项目中有一个功能需要在浏览器页面中浏览服务器的目录。服务器使用Nginx,而Nginx提供了相应的ngx_http_autoindex_module 模块,该模块提供了我们想要的功能。
本环境共有四个节点, 其角色分配如下(实验机器均为centos 7.x)
机器名称 | IP配置 | 服务角色 |
---|---|---|
manager | 172.17.44.144 | manager控制器 |
master | 172.17.44.45 | 数据库主服务器 |
slave1 | 172.17.44.44 | 数据库从服务器 |
slave2 | 172.17.44.143 | 数据库从服务器 |
bash[root@wtj1vpk8sql01 pg_cluster_source]# python3 get-pip.py
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f1535a96898>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f1535a96390>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f1535a96160>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f1535a8ffd0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pip/
^CERROR: Operation cancelled by user
^CTraceback (most recent call last):
File "get-pip.py", line 27079, in <module>
main()
File "get-pip.py", line 137, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 119, in bootstrap
sys.exit(pip_entry_point(args))
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/cli/main.py", line 70, in main
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/cli/base_command.py", line 98, in main
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/cli/base_command.py", line 214, in _main
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/cli/req_command.py", line 148, in handle_pip_version_check
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/self_outdated_check.py", line 145, in pip_self_version_check
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/package_finder.py", line 857, in find_best_candidate
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/package_finder.py", line 805, in find_all_candidates
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/sources.py", line 134, in page_candidates
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/package_finder.py", line 765, in process_project_url
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/collector.py", line 492, in fetch_page
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/collector.py", line 397, in _get_html_page
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/index/collector.py", line 131, in _get_html_response
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/requests/sessions.py", line 555, in get
File "/tmp/tmpfzntbvl5/pip.zip/pip/_internal/network/session.py", line 454, in request
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/requests/sessions.py", line 542, in request
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/requests/sessions.py", line 655, in send
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 53, in send
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/requests/adapters.py", line 449, in send
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/urllib3/connectionpool.py", line 706, in urlopen
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/urllib3/connectionpool.py", line 382, in _make_request
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/urllib3/connectionpool.py", line 1010, in _validate_conn
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/urllib3/connection.py", line 358, in connect
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/urllib3/connection.py", line 175, in _new_conn
File "/tmp/tmpfzntbvl5/pip.zip/pip/_vendor/urllib3/util/connection.py", line 86, in create_connection
KeyboardInterrupt
在 CentOS 7.9 下,你可以通过以下几种方法来更换 pip
的源。替换 pip
源可以加速 Python 包的安装过程,特别是在国内使用时,推荐使用国内的镜像源如阿里云、清华大学等。