V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
letitbesqzr
V2EX  ›  Java

tomcat 绑定域名后无法访问伪静态的页面

  •  
  •   letitbesqzr · Oct 16, 2014 · 3549 views
    This topic created in 4211 days ago, the information mentioned may be changed or developed.
    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 (没绑定域名的地址)

    没有伪静态的地址就正常.
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5605 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 07:08 · PVG 15:08 · LAX 00:08 · JFK 03:08
    ♥ Do have faith in what you're doing.