nginx支持泛域名解析的方法

in 服务器类
要使用Nginx下的泛域名支持,必须在编译 Nginx的时候加上
--with-http_sub_module
freebsd下ports安装的时候有提示的,选上即可。方法我google了半天,网上的好多我照做都是不行的,例如这个:

listen       80;
server_name  www.yourdomain.com *.yourdomain.com;

这个会提示:

# nginx -t
2009/01/04 13:22:56 [emerg] 63944#0: conflicting parameter "*.bsdlover.cn" in www.conf:14
2009/01/04 13:22:56 [emerg] 63944#0: the configuration file nginx.conf test failed

还有些文章里面说的是:

server_name  .yourdomain.com;

这个也是不行的,经过我的实验,正确的做法是:

listen       80;
server_name  _;

这样就可以了,留个笔记,呵呵

来源:http://bbs.bsdlover.cn/viewthread.php?tid=2194&highlight=nginx
0 Comments

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>