您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

nginx空主机头

2024/6/30 5:12:01发布21次查看
主机头
这个概念来源于windows iis服务器;我们可以简单理解为,一个主机头就是一个host;
nginx 禁止空主机头配置
可以根据域名和location来分发请求,反向代理;
譬如
server { listen 80; server_name _; ##标示空主机头 location / { root html; return404; } location ~ /.ht { deny all; } }
这样就禁止空主机头访问;
nginx 设置可以转发的域名
ss
server { listen 80; server_name www.test.com; location / { root html; index index.html index.htm; } } 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 500502503504 /50x.html; location = /50x.html { root html; } location ~ (favicon.ico) { root html; } }
在本机配置了两个虚拟主机,一个是www.test.com,一个是localhost;
而host绑定为(修改/etc/hosts文件):
127.0.0.1 localhost127.0.0.1 www.test.com127.0.0.1 www.test1.com
现在可以通过 localhost和 www.test.com访问,而通过www.test1.com访问则被拒绝,报404错误;
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了nginx空主机头,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product