嗨,我正在使用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"
然而root位于 /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
请帮助
答案 0 :(得分:0)
最后我找到了解决方案 在CMD_ADMIN_SETTINGS中的directadmin设置中将服务器的主机名(?)设置为与域相同并导致冲突