小编Chr*_*ris的帖子

Nginx conf为两个gunicorn应用程序(django和tilestache)

我正在尝试托管一个由django应用程序和由tilestache提供服务的地图图块组成的网站.我可以使用其中任何一个让它们分别运行和提供内容

gunicorn_django -b 0.0.0.0:8000 
Run Code Online (Sandbox Code Playgroud)

对于django应用程序,或

gunicorn "TileStache:WSGITileServer('tilestache.cfg')"
Run Code Online (Sandbox Code Playgroud)

对于tilestache.我已经尝试了daemonizing django应用程序并在另一个端口(8080)上使用tilestache进程同时运行它们,但是tilestache不起作用.我认为问题在于我的nginx conf:

server {
    listen   80;
    server_name localhost;

    access_log /opt/django/logs/nginx/vc_access.log;
    error_log  /opt/django/logs/nginx/vc_error.log;

    # no security problem here, since / is alway passed to upstream
    root /opt/django/;
    # serve directly - analogous for static/staticfiles
    location /media/ {
        # if asset versioning is used
        if ($query_string) {
            expires max;
        }
    }
    location /static/ {
        # if asset versioning is used
        if ($query_string) {
            expires max;
        }
    }
    location / {
        proxy_pass_header Server; …
Run Code Online (Sandbox Code Playgroud)

gis django nginx gunicorn

4
推荐指数
1
解决办法
3069
查看次数

Tomcat 不提供静态文件

我在这件事上已经束手无策了。我试图建立一个超级简单的网络应用程序,但我似乎无法让 tomcat 不出现 404 静态文件。

  • 我正在使用 gradle tomcat 插件和 tomcat 版本 7.0.39
  • 我的 html 文件位于hey-world/src/main/webapp/index.html
  • 我的web.xml看起来像这样:

    <servlet>
        <servlet-name>Resteasy</servlet-name>
        <servlet-class>
            org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
        </servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>HeyWorldApplication</param-value>
        </init-param>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/static/*</url-pattern>
    </servlet-mapping>
    
    <servlet-mapping>
        <servlet-name>Resteasy</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    
    Run Code Online (Sandbox Code Playgroud)

所以我以为这个设置会映射localhost:8080/hey-world/static/index.html到文件,但每次都是404。这是 gradle tomcat 插件中的某些约定的问题吗?

java tomcat web.xml gradle gradle-tomcat-plugin

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

django ×1

gis ×1

gradle ×1

gradle-tomcat-plugin ×1

gunicorn ×1

java ×1

nginx ×1

tomcat ×1

web.xml ×1