我的目标是做到这一点,以便我在单独服务器上的博客可以在example.com/blog上正常工作。该网站显示正常,但如果我尝试转到example.com/blog/2019/05/17/hello-world/,则显示404.如何解决此问题?这是我的服务器配置:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.html index.htm;
server_name _;
location /blog {
rewrite ^/blog/(.*)$ /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://1.1.1.1:80$request_uri$is_args$args;
proxy_redirect off;
}
try_files $uri $uri.html $uri/ =404;
}