与此问题类似,nginx重写也存在问题。
这是我的nginx conf:
server {
listen 80;
server_name myserver.com www.myserver.com;
index index.html;
root /var/www/myserver.com/site/;
location /blog {
alias /var/www/myserver.com/blog/output/;
break;
}
location / {
autoindex on;
try_files $uri $uri/ @htmlext;
}
location /.hg {
deny all;
return 404;
}
location ~ \.html$ {
try_files $uri =404;
}
location @htmlext {
rewrite ^(.*)$ $1.html last;
}
error_page 500 502 503 504 /media/50x.html;
}
看来问题出在location ~ \.html
规则上。当我删除它时,它工作正常。
我已经尝试了多种方法,例如:
location /blog
指令上移到顶部(以前在底部)break;
作为链接的问题提出。到目前为止,似乎没有任何工作。在当前配置中,我得到了404,这也显示在404中access.log
。
我该如何进行重写工作以隐藏.html
扩展名,还可以让我提供blog/output/
内容?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句