【问题标题】:Nginx serving static content and proxy to apacheNginx 为 apache 提供静态内容和代理
【发布时间】:2011-09-17 13:11:57
【问题描述】:

是否有我可以与 nginx 一起使用的配置,它可以为端口 80 上的所有 wbsites 提供所有静态内容,并且所有动态内容都将转发到端口 8080 上的 apache?最好我不想更改 apache vhosts 中的任何东西,而不是端口

我在哪里可以找到这样的工作配置?

【问题讨论】:

    标签: apache nginx


    【解决方案1】:

    这是一个很好的例子; http://wiki.nginx.org/FullExample

    特别强调这部分;

        server { # simple reverse-proxy
        listen       80;
        server_name  domain2.com www.domain2.com;
        access_log   logs/domain2.access.log  main;
    
        # serve static files
        location ~ ^/(images|javascript|js|css|flash|media|static)/  {
          root    /var/www/virtual/big.server.com/htdocs;
          expires 30d;
        }
    
        # pass requests for dynamic content to rails/turbogears/zope, et al
        location / {
          proxy_pass      http://127.0.0.1:8080;
        }
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 2020-03-26
      • 1970-01-01
      • 1970-01-01
      • 2012-03-26
      • 2014-07-30
      • 2011-03-24
      相关资源
      最近更新 更多