0

嗨,我正在使用 directadmin,我为 apache 设置了 nginx 反向代理,一切正常,除了只有一个域的静态文件返回 404

在 nginx 错误日志中我看到了这个

2015/08/02 10:34:27 [error] 1512#0: *62 openat() "/var/www/html/images/domain/landing/editor.gif" failed (2: No such file or directory), client: 2.144.108.127, server: domain.com, request: "GET /images/domain/landing/editor.gif HTTP/1.1", upstream: "http://x.x.x.x:8080/images/domain/landing/editor.gif", host: "domain.com"

但是根位于 /home/domain/domains/domain.com/public_html/

这是该域的 nginx conf

server
{
        listen x.x.x.x:80;
        server_name domain.com www.domain.com domain.org www.domain.org;
        access_log /var/log/nginx/domains/domain.com.log;
        access_log /var/log/nginx/domains/domain.com.bytes bytes;
        error_log /var/log/nginx/domains/domain.com.error.log;
        root /home/domain/domains/domain.com/public_html;
        index index.php index.html index.htm;
        include /usr/local/directadmin/data/users/domain/nginx_php.conf;
        location /
        {
                # access_log off;
                proxy_buffering off;
                proxy_pass http://x.x.x.x:8080;
                proxy_set_header X-Client-IP      $remote_addr;
                proxy_set_header X-Accel-Internal /nginx_static_files;
                proxy_set_header Host             $host;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        location /nginx_static_files/
        {
                access_log  /var/log/nginx/access_log_proxy;
                alias       /home/domain/domains/domain.com/public_html/;
                internal;
        }
        include /etc/nginx/webapps.conf;
}

和httpd conf

<VirtualHost x.x.x.x:80 >
ServerAlias *.domain.com
    ServerName www.domain.com
    ServerAlias www.domain.com domain.com  domain.org www.domain.org
    ServerAdmin webmaster@domain.com
    DocumentRoot /home/domain/domains/domain.com/public_html
    ScriptAlias /cgi-bin/ /home/domain/domains/domain.com/public_html/cgi-bin/
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        #SuexecUserGroup domain domain
                RMode config
                RUidGid domain domain
                RGroups apache
    </IfModule>
    <IfModule mod_ruid2.c>
        RMode config
        RUidGid domain domain
        #RGroups apache access
        RGroups @none
    </IfModule>
    CustomLog /var/log/httpd/domains/domain.com.bytes bytes
    CustomLog /var/log/httpd/domains/domain.com.log combined
    ErrorLog /var/log/httpd/domains/domain.com.error.log
    <Directory /home/domain/domains/domain.com/public_html>
        php_admin_flag engine ON
        php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f domain@domain.com'
        php_admin_value mail.log /home/domain/.php/php-mail.log
        php_admin_value open_basedir /home/domain/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php55/lib/php/
    </Directory>
</VirtualHost>

我还在 nginx 错误日志中看到这些错误

2015/08/02 10:34:18 [warn] 1503#0: conflicting server name "domain.com" on x.x.x.x:80, ignored
2015/08/02 10:34:18 [warn] 1503#0: conflicting server name "domain.org" on x.x.x.x:80, ignored

doman.com 域名服务器是 ns1.domain.com 和 ns2.domain.com

请帮忙

4

1 回答 1

0

最后我在 CMD_ADMIN_SETTINGS 中的 directadmin 设置中找到了解决方案它被设置为服务器的主机名(?)与域相同,这导致了冲突

于 2015-08-03T07:09:53.023 回答