v2ex站长小心眼 大佬有话说 :
求助nginx高手 三毛家vps无法反代google其他域名 主域名可以
/etc/nginx/nginx.conf是默认的没动:
user www-data;
worker_processes 1;
pid /run/nginx.pid;
worker_rlimit_nofile 65536;
events {
worker_connections 7680;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 0;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
log_formatmain’$remote_addr [$time_local] $status ($body_bytes_sent) "$host" "$request" ‘
‘$upstream_addr’ ;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
从sites-enabled导入123.conf
server{
listen *:1234;
access_log /var/log/nginx/access.log main;
error_log /dev/null;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
proxy_set_header Accept-Encoding "gzip, deflate";
proxy_pass https://$http_host$request_uri;
}
}
我这边发送http(非https)反代请求到我的vps:1234, 出现了诡异的一幕:
如果host是www.google.com就可以正常200
如果host是www.google.com.hk或者其他任何国名, 就出现了499 错误。
另外把这2个配置文件放在OVH或者其他美国vps上也全部正常。 只有三毛家出现这个问题。