如何让Harbor支持http访问
时间: 2023-09-17 15:07:11 浏览: 43
要使Harbor支持http访问,请按照以下步骤进行操作:
1. 修改Harbor配置文件
在Harbor服务器上,找到Harbor配置文件harbor.cfg并打开它。在文件中找到以下行:
#ui_url_protocol = https
#ssl_cert = /your/certificate/path
#ssl_cert_key = /your/certificate/key/path
将这些行中的注释符号(#)删除,并将ui_url_protocol的值改为http,如下所示:
ui_url_protocol = http
#ssl_cert = /your/certificate/path
#ssl_cert_key = /your/certificate/key/path
保存并关闭文件。
2. 重新启动Harbor
在Harbor服务器上,使用以下命令重新启动Harbor:
sudo docker-compose down -v
sudo docker-compose up -d
3. 打开防火墙端口
如果您的服务器上启用了防火墙,请确保打开HTTP端口(默认为80)以允许访问Harbor。
例如,在Ubuntu上,可以使用以下命令打开HTTP端口:
sudo ufw allow 80/tcp
完成以上步骤后,您就可以使用http协议访问Harbor了。请注意,使用http协议可能会降低安全性,因此请确保在安全环境中使用。
相关问题
ubuntu安装harbor 2.8.1 仅开启http
要在Ubuntu上安装Harbor 2.8.1并仅开启HTTP支持,可以按照以下步骤进行操作:
1. 安装Docker和Docker Compose。
```
$ sudo apt update
$ sudo apt install docker.io docker-compose
```
2. 下载Harbor 2.8.1的离线安装包。
```
$ wget https://github.com/goharbor/harbor/releases/download/v2.8.1/harbor-offline-installer-v2.8.1.tgz
```
3. 解压缩安装包。
```
$ tar xvf harbor-offline-installer-v2.8.1.tgz
```
4. 编辑Harbor配置文件`harbor.yml`,将`https`的值改为`false`,表示仅使用HTTP。
```
# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: your.harbor.domain
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 80
# The http secret is used to provide protection for some features such as webhook.
# It should be a random string (a string of at least 12 characters, which contains letters, numbers, and special characters).
secret: your-secret
# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433
# Uncomment the following lines if you want to enable https
# https:
# port: 443
# # The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path
```
5. 执行安装脚本。
```
$ cd harbor
$ sudo ./install.sh --with-notary --with-clair --with-trivy
```
如果您只想安装Harbor核心组件而不安装其他组件,则可以省略`--with-notary`、`--with-clair`和`--with-trivy`选项。
6. 安装完成后,使用以下命令启动Harbor服务:
```
$ sudo docker-compose up -d
```
这将启动Harbor服务并在后台运行。
现在,您可以通过浏览器访问http://your.harbor.domain来访问Harbor管理界面,并使用默认用户名和密码(admin/Harbor12345)进行登录。
harbor https
Harbor支持使用HTTPS进行安全连接。要配置Harbor以使用HTTPS,你需要在harbor.yml文件中指定主机名和https属性,并提供证书和密钥文件的路径。你可以通过复制模板配置文件(harbor.yml.tmpl)来创建harbor.yml文件,并在其中进行相应的修改。在配置文件中,你需要将hostname设置为你的域名,并提供证书和密钥文件的路径。证书和密钥文件可以通过指定certificate和private_key字段来设置。此外,你还可以指定https端口,默认为443。
默认情况下,Harbor是没有附带证书的,可以在没有安全性的情况下部署Harbor,使用HTTP进行连接。但是,在生产环境中,建议使用HTTPS来确保安全性。特别是如果你要使用Content Trust with Notary,HTTPS是必需的。
在保存和配置好harbor.yml文件后,你可以启用Harbor服务。可以使用以下命令来启用Harbor服务:
```
chmod 644 harbor.service
systemctl daemon-reload
systemctl enable harbor
```
这将使Harbor服务生效并自动启动。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [配置对 Harbor 的 HTTPS 访问](https://blog.csdn.net/fly910905/article/details/127817508)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]