まず、準備作業の
システム環境:CentOSの7.6 64
新規インストールは、についての簡単なセットが必要です
$ ip addr
デフォルトのネットワークカードが起動していない発見されました。
vi /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT =変更なしのONBOOT = yesをした後、ネットワークサービスを再起動し保存
$ sudo service network restart
第二に、インストールの開始
コンパイルツールを
yum install gcc gcc-c++ make -y
yum install rpm-build rpmdevtools -y
インストールが依存します
yum install pcre-devel pcre -y
yum install zlib-devel zlib -y
yum install openssl-devel openssl -y
#yum install redhat-lsb-core -y
いいえgitのは、井戸のwgetをインストールしていません
yum install git
yum -y install wget
ダウンロードモジュールに使用
git clone https://github.com/chobits/ngx_http_proxy_connect_module.git
ダウンロードnginxの
$ wget http://nginx.org/download/nginx-1.9.2.tar.gz
$ tar -xzvf nginx-1.9.2.tar.gz
抽出されたディレクトリに
$ cd nginx-1.9.2/
設定パラメータ(翻訳モジュール)
$ patch -p1 < /root/ngx_http_proxy_connect_module/patch/proxy_connect.patch
$ ./configure --add-module=/root/ngx_http_proxy_connect_module
コンパイル - インストール
$ make && make install
スタートnginxの
cd /usr/local/nginx/sbin/
./nginx
ファイル、コアコード変更Nginx.conf
>設定2を-
#http协议 80端口 -只是监听端口
server {
listen 80;
resolver 114.114.114.114;
#server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass $scheme://$http_host$request_uri;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#https协议(SSL) 443端口 -只是监听端口
server {
resolver 114.114.114.114; #DNS
listen 443;
#server_name localhost; #要做正向代理, 不需要server_name
proxy_connect;
proxy_connect_allow 443 563;
proxy_connect_connect_timeout 10s;
proxy_connect_read_timeout 10s;
proxy_connect_send_timeout 10s;
#access_log /var/log/nginx/http_proxy.access.log main;
#error_log /var/log/nginx/http_proxy.error.log;
location / {
proxy_pass $scheme://$http_host$request_uri;
}
}
設定の再ロード
./nginx -s reload
Googleに次の使用nginxのフォワードプロキシは、プロキシエージェントのネットワーク設定を拡大しました。
記事住所:https://blog.csdn.net/NL45426/article/details/101170394