【发布时间】:2013-12-15 11:56:32
【问题描述】:
我在 /var/www/blog 中安装了 wordpress。我想通过 www.domain.com 访问它,所以我创建了一个 domain.com 的 Nginx 配置文件,其中包含:
server {
listen 80;
server_name domain.com www.domain.com;
root /var/www/blog;
index index.php index.html index.htm;
access_log /var/log/nginx/www.domain.com.access.log;
error_log /var/log/nginx/www.domain.com.error.log;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
但是当我打开 www.domain.com 时,没有加载 css/js 文件。在我的 error.log 中,我得到了:
2013/12/15 12:47:29 [error] 19562#0: *9 open() "/var/www/blog/blog/wp-content/themes/twentytwelve/style.css" failed (2: No such file or directory), client: yy.yy.yy.yy, server: domain.com, request: "GET /blog/wp-content/themes/twentytwelve/style.css?ver=3.8 HTTP/1.1", host: "xx.xx.xx.xx", referrer: "http://xx.xx.xx.xx/"
2013/12/15 12:47:29 [error] 19562#0: *11 open() "/var/www/blog/blog/wp-content/themes/twentytwelve/js/navigation.js" failed (2: No such file or directory), client: yy.yy.yy.yy, server: domain.com, request: "GET /blog/wp-content/themes/twentytwelve/js/navigation.js?ver=1.0 HTTP/1.1", host: "xx.xx.xx.xx", referrer: "http://xx.xx.xx.xx/"
我不明白为什么在链接中添加了“/blog/”。 感谢您的帮助!
【问题讨论】: