Professional Documents
Culture Documents
us
这个页面中的配置结果将会影响到下面 2 个配置情况:
1:设置上下文
外部客户连接到 NGINX 使用安全的 SSL。在 NGINX 和 Confluence 服务器之间的连接不是 路径
安全的。 2:配置
Confluence 服务器和 NGINX 运行在同一个机器中。 Tomcat 连接器
3:配置 NGINX
4:重启
Confluence 和
NGINX
1:设置上下文路径
如果你不希望通过上下文来访问你的 Confluence 安装实例(www.example.com),或者你是直接通过子域名来访问的(confluence.example.
com),你可以跳过这一步的配置。
然后修改为:
在这个示例中,我们已经使用了/confluence为上下文的路径。请注意,你不能使用/resources为你的上下文路径,因为在 Confluence 中
使用这个路径用于定位资源,如果你使用这个路径的话将会在后面导致错误。
重启 Confluence,然后检查你是否可以访问http://example:8090/confluence
注释掉默认的连接器(针对不需要代理的访问)。
<!--
========================================================
DEFAULT - Direct connector with no proxy, for unproxied HTTP access
to Confluence.
========================================================
-->
<!--
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-
8"
protocol="org.apache.coyote.http11.Http11NioProtocol"/>
-->
<!--
========================================================
DEFAULT - Direct connector with no proxy, for unproxied HTTP access
to Confluence.
========================================================
-->
<!--
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-
8"
protocol="org.apache.coyote.http11.Http11NioProtocol"/>
-->
...
<!--
========================================================
HTTPS - Proxying Confluence via Apache or Nginx over HTTPS
========================================================
-->
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-
8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="https" secure="true" proxyName="<subdomain>.<domain>.com"
proxyPort="443"/>
请确定你已经为你的协议和代理名称配置了争取的值。
3:配置 NGINX
你需要在你的的 NGINX 服务器中指定一个监听服务器,如下面的示例内容。同时添加下面的内容到你的 NGINX 配置中。
在这个示例中,用户将要连接到 Synchrony,这个服务运行直接协作编辑。
server {
listen www.example.com:80;
server_name www.example.com;
ssl_session_timeout 5m;
location /confluence {
client_max_body_size 100m;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8090/confluence;
}
location /synchrony {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8091/synchrony;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
请参考https://nginx.org/en/docs/http/ngx_http_proxy_module.html来获得更多的信息。
如果你不确定在那里包含 ssl_ciphershttps://mozilla.github.io/server-side-tls/ssl-config-generator/中的内容,这里的内容能非常有用。
location /server-info.action {
proxy_pass http://localhost:8090/confluence/server-info.action;
}
server {
listen confluence.example.com:80;
server_name confluence.example.com;
ssl_session_timeout 5m;
location / {
client_max_body_size 100m;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8090;
}
location /synchrony {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8091/synchrony;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}