GUI없이 프록시를 어떻게 구성합니까? Server 또는 Minimal (CLI) 버전에서 프록시 설정을

터미널을 사용하여 Ubuntu Server 또는 Minimal (CLI) 버전에서 프록시 설정을 어떻게 구성합니까?



답변

CLI Ubuntu / Server의 시스템 전체 프록시는 환경 변수로 설정해야합니다.

  • (또는 선호하는 편집기)로 /etc/environment파일을 엽니 다 vi. 이 파일은 부팅시 초기화 된 시스템 전체 변수를 저장합니다.
  • 적절하게 수정하여 다음 줄을 추가하십시오. (불행히도) 일부 프로그램은 하나만 찾아야하기 때문에 대문자와 소문자로 복제해야합니다.

    http_proxy = "http://myproxy.server.com:8080/"
    https_proxy = "http://myproxy.server.com:8080/"
    ftp_proxy = "http://myproxy.server.com:8080/"
    no_proxy = "localhost, 127.0.0.1, localaddress, .localdomain.com"
    HTTP_PROXY = "http://myproxy.server.com:8080/"
    HTTPS_PROXY = "http://myproxy.server.com:8080/"
    FTP_PROXY = "http://myproxy.server.com:8080/"
    NO_PROXY = "localhost, 127.0.0.1, localaddress, .localdomain.com"
    
  • apt-get, aptitude정상적으로 사용하는 경우 등의 환경 변수에 순종하지 않을 것이다 sudo. 따라서 별도로 구성하십시오. 라는 파일 생성 95proxies에을 /etc/apt/apt.conf.d/하고 다음을 포함한다 :

    획득 :: http :: proxy "http://myproxy.server.com:8080/";
    획득 :: ftp :: proxy "ftp://myproxy.server.com:8080/";
    획득 :: https :: proxy "https://myproxy.server.com:8080/";
    

마지막으로, 로그 아웃 한 후 재부팅하여 변경 사항을 적용하십시오.


출처 : 1 , 2 . 프록시를 빠르게 켜고 끄는 스크립트를 포함한 추가 도움말은 특히 1을 참조하십시오.


답변

인증 프록시가 있으면 URL이 달라집니다. 대신에:

"http://myproxy.server.com:8080/"

당신은 할 것이다 :

"http://user_name:password@myproxy.server.com:8080/"

이들은 여전히 ​​URL이므로 비밀번호 (및 사용자 이름)는 URL로 인코딩되어야 합니다.

예를 들어, 사용자 이름 muru과 비밀번호 )qv3TB3LBm7EkP}는 다음과 같습니다.

"http://muru:)qv3TB3LBm7EkP%7D@myproxy.server.com:8080/"

이것은 다양한 방법으로 수행 할 수 있습니다.

  1. 인코딩을위한 여러 웹 사이트가 있습니다.
  2. 프로그래밍 방식 :

핀치에서 man url어떤 문자를 인코딩 해야하는지 확인할 수 있습니다 .

An escaped octet is encoded as a character triplet,
consisting of the percent character "%" followed by
the two hexadecimal digits representing the octet code...

그리고 옥텟 코드는에서 사용할 수 있습니다 man ascii.


답변

                                 Proxy Environment Variables:

http_proxy : HTTP 트래픽 용
프록시 서버
https_proxy : HTTPS 트래픽 용 프록시 서버 ftp_proxy : FTP 트래픽 용 프록시 서버
no_proxy : 프록시를 사용하지 않아야하는 IP 주소 또는 도메인 이름 패턴

no_proxy를 제외한 모든 프록시 설정의 값은 동일한 템플릿을 사용합니다.
proxy_http=username:password@proxy-host:port

임시 설정 프록시 :
export HTTP_PROXY=user:pass@my.proxy.server:8080

영구 프록시 설정 : vim ~/.bash_profilebash 설정 파일을 열고 다음 줄을 넣습니다.

export http_proxy=username:password@proxyhost.com:8080
export https_proxy=username:password@proxyhost.com:8081
export no_proxy=localhost, 127.0.0.1, *.my.lan

source ~/.bash_profile변경 사항을 적용하는 데 사용


답변