我的问题是这样的
我想同时使用二级域名和gzip
思路是不是这样的..?
二级域名 跳到 一级下面的端口 a.abc.com 跳到 abc.com:4000,
然后继续跳到设置gzip的端口 abc.com:4000 跳到 abc.com:3000?
//二级域名的代理
server {
listen 80;
server_name a.abc.com
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://abc.com:4000;
}
}
// gzip 的代理
server {
listen 4000;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://abc.com:3000;
proxy_redirect off;
}
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_types application/javascript text/plain application/x-javascript text/css text/javascript application/x-httpd-php image/jpeg image/gif image/png;
location /static/ {
root /home/r-ct/front/src;
}
}