我目前正在从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 {}中,则该域工作正常.
我一直试图解决这个问题几个小时,但我想我做错了什么?