nginx忽略我的包含指令?

我目前正在从Apache迁移到nginx。 我有几个域将被托pipe在同一台机器上有一个IP地址。 虽然我configurationnginx --prefix=/my/path但似乎nginx不包含我的vhostconfiguration文件。

我目前的nginx.conf如下所示:

 http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; # Don't show server version. server_tokens off; index index.html index.htm index.php; # Default server server { listen 81 default; server_name _; access_log logs/access.log main; server_name_in_redirect off; root html; } ## Load virtual host conf files. ## include conf/vhosts/*/*.conf; # config/vhosts/domain.com/domain.conf ; subodmain.conf and etc } 

这是我在config / vhosts / domain.com / domain.com.conf中唯一的vhostconfiguration:

 server { listen 81; server_name domain.com; access_log logs/domain.com.access.log main; root "/www/domain.com/htdocs"; index index.html; } 

我也尝试设置configuration文件的绝对path,但它也没有工作。 所有的请求都在默认服务器上登陆。 但是,如果您将conf/vhosts/domain.com/domain.com.conf的内容插入到conf/nginx.conf http{}该域可以正常工作。

我一直试图弄清楚几个小时,但我想我做错了什么?

正如文档所述。

从版本0.6.7开始,path是相对于nginxconfiguration文件nginx.conf的目录,而不是nginx前缀目录。

如果你确认path是相对于nginx的configuration文件,那么它仍然无法正常工作?

上面的答案到现在为止是错误的。 根据文件:

nginx只使用绝对path,configuration文件中的所有相对path都是相对于–prefix == PATH。

http://wiki.nginx.org/CoreModule