【发布时间】:2015-04-08 03:36:30
【问题描述】:
我目前正忙于配置 Jekyll 和 nginx 以在 VPS 上协同工作。 本质上,我设置了从本地机器到 VPS 的所有内容和一个 git 挂钩。
这是我的 nginx 配置文件:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www;
index index.php index.html index.htm;
server_name server_ip;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
server_name server_ip/blog;
location / {
root /var/www/blog;
index index.html index.htm;
}
}
理想情况下,我现在希望在blog.domain.example 或blog.server_ip 提供/var/www/blog 中的内容。
但是,当jekyll build 运行时,URL 都是错误的。我可以在server_ip/blog 看到index.html,但是在Jekyll 页面上的链接中没有复制URL 中的/blog/ 位。
例如,帖子应位于server_ip/blog/2015/04/07/title,但我得到的网址是server_ip/2015/04/07/title。 CSS 文件和图像也是如此。
非常感谢您的帮助。
【问题讨论】: