在内网服务器
nginx.conf 配置如下:
#user nobody;
worker_processes auto;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 65535;
}
http {
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 1000;
gzip_disable "msie6";
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m inactive=60m;
proxy_cache_key "$scheme$request_method$host$request_uri";
proxy_cache_valid 200 206 60m;
proxy_cache_valid 404 1m;
keepalive_timeout 65;
keepalive_requests 100;
tcp_nopush on;
client_max_body_size 200m;
include mime.types;
default_type application/octet-stream;
sendfile on;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
include vhost/*.conf;
}
vhost 里的文件是这样写的:
server {
listen 8081;
server_name localhost;
client_max_body_size 100M;
location / {
root /data/xxx/dist/;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~/mall_war/ {
proxy_pass http://localhost:8900;
}
}
然后我在腾讯云上的公网服务器的 nginx 对他做反向代理,nginx.conf 配置一样,然后我的反向代理文件是这样写的
upstream test{
server xxx.xxx.xxx.xxx:8081;
}
server {
listen 443 ssl;
server_name test.abc.com;
ssl_certificate "/usr/local/nginx/ssl/test.abc.com.pem";
ssl_certificate_key "/usr/local/nginx/ssl/test.abc.com.key";
location / {
proxy_pass http://test;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
现在就是几个人访问也一直报错
upstream prematurely closed connection while reading response header from upstream
一直报这个错误
是网络问题?还是 nginx 配置有问题?
请大佬帮忙看看,实在不懂咋搞了。