我目前正在从Apache迁移到nginx.我有几个域将在一台IP地址的同一台机器上托管.虽然我已经配置了nginx –prefix = / my / path,但似乎nginx不包含我的vhost配置文件.
我当前的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中唯一的vhost配置:
server {
listen 81;
server_name domain.com;
access_log logs/domain.com.access.log main;
root "/www/domain.com/htdocs";
index index.html;
}
我也尝试设置配置文件的绝对路径,但它也不起作用.所有请求都登陆默认服务器.但是,如果您将conf / vhosts / domain.com / domain.com.conf的内容插入到conf / nginx.conf http {}中,则该域工作正常.
我一直试图解决这个问题几个小时,但我想我做错了什么?
最佳答案
正如文档所述.
Since version 0.6.7,paths are relative to directory of nginx configuration file nginx.conf,but not to nginx prefix directory.
如果验证路径是否与nginx配置文件相关,那么它仍然不起作用吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。