最近做SEO优化,要求返回正确的Content-Language;
response.setHeader("Content-Language", "ja");//这个设置没用,这个值跟操作系统有关
于是在nginx重写这个值,简略配置如下;
环境 :http://localhost/french;http://localhost/japanese........等;
location /{ proxy_hide_header 'Content-Language'; #隐藏掉之前的值 if ($request_uri ~* "/china"){ #根据不同的国家添加不同的值 add_header Content-Language cn; } if ($request_uri ~* "/japanese"){ add_header Content-Language ja; } if ($request_uri ~* "/french"){ add_header Content-Language fr; } proxy_pass http://home_server; } rewrite /china /test/index.do?locale=cn&custom=1 last; rewrite /french /test/index.do?locale=fr&custom=2 last; rewrite /japanese /test/index.do?locale=ja&custom=3 last; rewrite ^/(.*) /test/index.do?locale=$1&custom=4 last;
以上代码在nginx-1.5.3 windows平台上测试通过.
请看官方文档:
Note that for headers other than Last-Modified
, it just appends a new header entry to the output header list. So you can't use this directive to rewrite existing headers likeServer
. Use the headers_more module for it.
大概意思是说add_header这个参数不能修改 Last-Modified
除这个之外的值,如果你要修改,使用headers_more 这个扩展.由于我在windows上测试的,没法编译扩展到nginx,so用上面的办法!(╰_╯)#..
相关推荐
windows平台nginx编译nginx-http-flv-module,可直接运行,基于nginx-1.17.10编译
在windows 7 64位 环境下使用nginx的nginx-http-flv-module搭建flv视频流播放所有的安装包,参考:https://blog.csdn.net/qq_33071429/article/details/102628008
--> nginx-1.21.6 ======================== 在网上查找半天都只有教程,没有可免费下载的版本,深知没有积分遍地找资源的痛苦,无奈之下只好自己按照教程一步一个坑编译出来的,供大家免费下载使用。(无毒放心使用...
nginx sticky是nginx的module,可以实现基于cookie的负载均衡。 下载后,在编译安装nginx时,用--add-module... ./configure --prefix=/usr/local/nginx-1.6.0 --add-module=../nginx-sticky-module-1.25 --without-...
资源说明: 1. 采用nginx最新版编译,包含最新的nginx-http-flv-module,以及基础...1. 将压缩包解压到D:\nginx-1.19.3目录下 2. 使用cmd命令打开DOS,并切换到D:\nginx-1.19.3 3. 使用nginxservice.exe install安装
此资源有两个文件,含 nginx-upstream-jvm-route 和 nginx 对应版本,都是tar.gz文件。 安装方法网上很多就不写了,亲测可用。 不用担心版本不匹配造成安装失败,再浪费积分去到处下载尝试的烦恼。 此资源有两个文件...
基于nginx1.19.3版本,已编译好nginx-http-flv-module,开箱即用。鄙视那些收C币的。
1、最新版 nginx-http-flv-module(windows可执行程序,含nginx 1.19.3,http-flv-module:1.2.7) 2、内含说明文档,请下载查看。 3、请勿放置于中文路径下,否则无法启动
windows版,2021年6月23日编译,已编译nginx-http-flv-module直播推流模块
1、最新版 nginx-http-flv-module(linux可执行程序,含nginx 1.19.3,http-flv-module:1.2.7) 2、内含说明文档,请下载查看。 3、请勿放置于中文路径下,否则无法启动 4、sbin/nginx -c conf/nginx.conf
添加nginx-http-flv-module模块并重新编译后的nginx(windows版)
nginx + nginx-http-flv-module-1.2.9
1、nginx-http-flv-module(windows可执行程序,含http-flv-module:1.2.7,nginx 1.19.3) 2、不要放置于中文路径下,否则无法启动 3、说明文档,请下载查看。
windows下编译nginx-http-flv-moudle,编译好的,下载开箱可用,作者亲测。用于直播推流,浏览器flvjs播放视频,支持无插件flash播放。
nginx带nginx-http-flv模块,包含所有rtmp功能,我自己在windows下编译的,直接可用,用的是最新版的1.19.4版本
nginx-upstream-jvm-route 支持nginx版本1.15 解决nginx: [emerg] invalid parameter "srun_id=tomcat1" 问题
nginx-http-flv-module-master.zip 为http-flv做直播推流需要用到的,功能比rtmp-moudle强大。
nginx-rtmp-module-master源码
nginx-rtmp模块源码包nginx-rtmp-module-master
windows服务注册: 1. 将压缩包解压到D:\nginx-1.19.3目录下 2. 使用cmd命令打开DOS,并切换到D:\nginx-1.19.3 3. 使用nginxservice.exe install安装 若需要自定义路径,注意在nginxservice.xml文件中修改路径