加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

nginx忽略了我的include指令?

发布时间:2020-12-13 21:15:58 所属栏目:Nginx 来源:网络整理
导读:我目前正在从Apache迁移到nginx.我有几个域将在一台IP地址的同一台机器上托管.虽然我已经配置了nginx prefix = / my / path,但似乎nginx不包含我的vhost配置文件. 我当前的nginx.conf看起来像这样: http { include mime.types; default_type application/oc

我目前正在从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配置文件相关,那么它仍然不起作用吗?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读