首页 > 系统相关 >nginx静态目录加上动态URL转发

nginx静态目录加上动态URL转发

时间:2023-01-09 20:38:36浏览次数:43  
标签:set http header URL nginx html proxy 转发 location


vim /data/application/nginx-1.10.3/conf/nginx.conf


sendfile on;
#tcp_nopush on;

#keepalive_timeout 65;
keepalive_timeout 0;

#gzip on;

# server {
# listen 80;
# server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

# location / {
# root html;
# index index.html index.htm;
# }

#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;
# }

# }

server {
listen 80;
server_name aaaa.com localhost;
location / {
root /aaa-sys; # 站点根目录
try_files $uri $uri/ /index.html;
}
location ^~ /aaa_system {
#proxy_pass http://custom-file-servier.app.aa.com/customFileServier/;
proxy_pass http://training-system.app.aaa.com/training_system/;
#proxy_set_header Host 127.0.0.1;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

location ^~ /customFileServier {
proxy_pass http://custom-file-servier.app.aaa.com/customFileServier/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 20m;

}

}

}

 

标签:set,http,header,URL,nginx,html,proxy,转发,location
From: https://blog.51cto.com/u_14650780/5998728

相关文章

  • mysql+nginx+keepalived的高可用玩法
     AB 做负载均衡, CD做负载均衡,ABCD 四个服务器虚拟一个IPkeepalived强制分流到主中心的AB两台机器当主中心停电后,keepalived分流到备中心CD两台机器可以找我帮忙搞哈......
  • 【转】nginx调优之使用return代替rewrite做重定向
    使用return代替rewrite做重定向转自:https://www.jianshu.com/p/26dc6c2b5f43原文地址:https://github.com/trimstray/nginx-admins-handbook/blob/master/doc/RULES.md#be......
  • CTOS NGINX绑定域名转发到DOCKER
    server{listen80default_server;listen[::]:80default_server;#SSLconfiguration##listen443ssldefault_server;......
  • NGINX基本编译安装和配置绑定域名或者默认路径页面
    tar-xvfnginx-1.21.4.tar.gzlscdnginx-1.21.4lsyum-yinstallpcrepcre-develyum-yinstallopenssl-devel#也可以去掉-add-module的东西./configure--user=nginx-......
  • nginx用TCP转发HTTP
    stream{upstreamsocket_proxy{hash$remote_addrconsistent;server127.0.0.1:80weight=5max_fails=3fail_timeout=120s;}server{......
  • nginx_扩容提升吞吐量
    扩容方式单机垂直扩容:硬件资源增加水平扩展:集群化细粒度拆分:分布式 1.数据分区 2.上游服务SOA化 3.入口细分 1.浏览器 2.移动端原生App 3.H5内嵌式应用 4.数......
  • SpringBoot笔记--Failed to configure a DataSource: 'url' attribute is not specifi
    问题描述写了SpringBoot代码之后,运行不出来结果,报出这样的一个错误:FailedtoconfigureaDataSource:'url'attributeisnotspecifiedandnoembeddeddatasourceco......
  • [VueJsDev] 日志 - nginxConfig 配置文件备份
    [VueJsDev]目录列表https://www.cnblogs.com/pengchenggang/p/17037320.htmlnginxConfig配置文件备份:::details目录目录nginxConfig配置文件备份Step.1:服务器......
  • Nginx多级反向代理下的IP透传
    透传IP为何要做透传IP在使用了CDN做加速站点静态资源加速后,当用户请求的静态资源没能命中,此时CDN会到源站请求内容,那么此时访问源站的IP为CDN节点的IP,不仅如此,可能经我们......
  • nginx 配置443 域名
    1申请域名(公有云)2下载证书pemkey并上传服务器指定目录3公有云上做A记录解析(解析到代理的nginx)4nginx配置443模块配置内容:server{listen80;......