从本地主机到domain.com/etherpad设置apache反向代理

时间:2019-03-20 00:08:37

标签: apache2 reverse-proxy etherpad

晚上好,
我正在尝试设置apache2反向代理
(紧跟https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy之后)
适用于etherpad lite
(紧随https://www.howtoforge.com/tutorial/ubuntu-etherpad-editor-server-installation/之后,nginx部分除外)。
我使用http-> ssl重定向。由于我使用letencrypt,因此我只能访问domain.com,而不能访问etherpad.domain.com(至少firefox不允许我访问,并且我想避免每次添加新站点时都更改该证书)。因此,我想访问我的etherpad就像访问其他站点一样:domain.com/etherpad。但是我总是得到一个404试图进入该站点。看一个工作示例,在我的nextcloud.conf文件中,有一行写着:
别名/ nextcloud / local / path / to / nextcloud
但是etherpad反向代理虚拟主机文件看起来完全不同,主要区别在于etherpad没有本地文件夹,只有一个mysql数据库。 (如果这是错误的,请纠正我)
因此,我尝试将ssl示例从第二个链接更改为以下示例,但它不起作用。请理解,我更改了域名和一些内部路径,但是“ apache2ctl configtest”成功,并且服务正在正常运行。

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName randomisedDomain.com/etherpad

    # SSL configuration
    SSLEngine on
    # If you hold wildcard certificates for your domain the next two lines are not necessary.
    SSLCertificateFile "/working/path/to/fullchain.pem"
    SSLCertificateKeyFile "/working/path/to/privkey.pem"

    ProxyVia On
    ProxyRequests Off
    ProxyPreserveHost on

    <Location />
        AuthType Basic
        AuthName "Welcome to the randomisedDomain.com Etherpad"
        AuthUserFile /working/path/to/etherpad.passwd
        #AuthGroupFile /path/to/svn.group
        Require user etherpad
        ProxyPass http://localhost:9001/ retry=0 timeout=30
        ProxyPassReverse http://localhost:9001/
    </Location>
    <Location /socket.io>
        # This is needed to handle the websocket transport through the proxy, since
        # etherpad does not use a specific sub-folder, such as /ws/ to handle this kind of traffic.
        # Taken from https://github.com/ether/etherpad-lite/issues/2318#issuecomment-63548542
        # Thanks to beaugunderson for the semantics
        RewriteEngine On
        RewriteCond %{QUERY_STRING} transport=websocket    [NC]
        RewriteRule /(.*) ws://localhost:9001/socket.io/$1 [P,L]
        ProxyPass http://localhost:9001/socket.io retry=0 timeout=30
        ProxyPassReverse http://localhost:9001/socket.io
    </Location>

    <Proxy *>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Proxy>
</VirtualHost>

对于将localhost域重新路由到randomizedDomain.com/etherpad的任何帮助,我们深表感谢!

最诚挚的问候
MAPster

0 个答案:

没有答案