---
title: 配置网络代理
description: "如果无法直接访问外网，则需要配置网络代理。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengwebs/ecosystemEnable/Tomcat/kunpengtomcat_04_0004.html
sourcePath: /source/zh/kunpengwebs/ecosystemEnable/Tomcat/kunpengtomcat_04_0004.html
indexId: f1e064dc00104420989b21c3a6576705a55455cfc8843884ec41e43f4480a57372
---
# 配置网络代理

如果无法直接访问外网，则需要配置网络代理。

1. 修改profile文件。

  a. 打开“/etc/profile”文件。
    1 vim /etc/profile

  b. 按“i”进入编辑模式，在“/etc/profile”文件中增加以下内容（根据实际情况填写）。
    1 2 3 export HTTP_PROXY="http://用户名:密码@代理IP:代理端口" export HTTPS_PROXY=$http_proxy export NO_PROXY=127.0.0.1,.huawei.com,localhost,local,.local

  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
  d. 使代理生效。
    1 source /etc/profile

2. 使用curl命令访问任意网站，若能显示网站信息则表示代理配置成功，可以访问外网。
