Apache-2.2

SVN、TRAC 和 web 與 Nginx 和 Apache

  • September 14, 2012

我的伺服器中安裝了 SVN、TRAC 和 Web 伺服器。SVN 和 TRAC 服務在 Apache 上配置,監聽 81 埠,http://localhost:81/svn(帶有基本的 http auth)和http://localhost:81/trac.

Web伺服器是NGINX,監聽80埠。

我想配置 nginx 以允許使用http://localhost/svn和訪問 SVN 和 TRAC http://localhost/trac

在配置文件中的“ server { ”和“ } ”之間:

location /svn {
       proxy_pass         http://127.0.0.1:81/svn;
       proxy_redirect     off;

       proxy_set_header   Host             $host;
       proxy_set_header   X-Real-IP        $remote_addr;
       proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
       proxy_max_temp_file_size 0;

       client_max_body_size       10m;
       client_body_buffer_size    128k;

       proxy_connect_timeout      90;
       proxy_send_timeout         90;
       proxy_read_timeout         90;

       proxy_buffer_size          4k;

       proxy_buffers              4 32k;
       proxy_busy_buffers_size    64k;
       proxy_temp_file_write_size 64k;

       proxy_pass_request_headers on;
       proxy_no_cache $cookie_nocache  $arg_nocache $arg_comment;
       proxy_no_cache $http_pragma     $http_authorization;
       proxy_set_header HTTP_AUTHORIZATION $http_authorization;
}


location /trac {
       proxy_pass         http://127.0.0.1:81/trac;
       proxy_redirect     off;

       proxy_set_header   Host             $host;
       proxy_set_header   X-Real-IP        $remote_addr;
       proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
       proxy_max_temp_file_size 0;

       client_max_body_size       10m;
       client_body_buffer_size    128k;

       proxy_connect_timeout      90;
       proxy_send_timeout         90;
       proxy_read_timeout         90;

       proxy_buffer_size          4k;
       proxy_buffers              4 32k;
       proxy_busy_buffers_size    64k;
       proxy_temp_file_write_size 64k;
}

引用自:https://serverfault.com/questions/427427