nginx配置:
server {
listen 443;
server_name java.sqzr.cc;
ssl on;
ssl_certificate /usr/local/nginx/conf/ssl/1_java.sqzr.cc_bundle.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/2_java.sqzr.cc.key;
location / {
default_type text/html;
# proxy_cache amproxy;
subs_filter_types text/css text/xml;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Referer
http://java.sqzr.cc:8080;
proxy_set_header Host java.sqzr.cc;
proxy_pass
http://java.sqzr.cc:8080;
proxy_set_header Accept-Encoding "";
}
}
------
tomcat:
<Host name="java.sqzr.cc" debug="0" appBase="/usr/local/tomcat/webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/usr/local/tomcat/webapps/blog" reloadable="true" />
</Host>
------
使用的urlrewrite库配置:
<urlrewrite>
<rule>
<from>/$</from>
<to type="forward">/index.html?page=1</to>
</rule>
<rule>
<from>/page/([0-9]+)\.shtml</from>
<to type="forward">/index.html?page=$1</to>
</rule>
<rule>
<from>/blog/archives.shtml</from>
<to type="forward">/archives.html</to>
</rule>
<rule>
<from>/blog/(.*)\.shtml</from>
<to type="forward">/blog.html?uri=$1</to>
</rule>
<rule>
<from>/category/(.*)\.shtml</from>
<to type="forward">/category.html?uri=$1</to>
</rule>
</urlrewrite>
https://java.sqzr.cc/blog/asdsa.shtml (绑域名后的地址,通过nginx反代后的)
http://117.78.0.238:8080/blog/blog/asdsa.shtml (没绑定域名的地址)
没有伪静态的地址就正常.