nginx忽略了我的include指令?

前端之家收集整理的这篇文章主要介绍了nginx忽略了我的include指令?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_0@

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

原文链接:https://www.f2er.com/nginx/435342.html

猜你在找的Nginx相关文章