如何在同一个域上通过代理传递实现 apache 别名

Joh*_*ohn 5 apache wordpress node.js

我们有一个使用 vhost 运行的 nodeJs 站点,如下所示:

<VirtualHost *:80>
    ServerName domain.org
    ServerAlias www.domain.org

    ProxyPass / http://localhost:8884/
    ProxyPassReverse / http://localhost:8884/
    ProxyPreserveHost on
    LogLevel debug
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这工作正常。

但是我们现在的任务是安装一个 wordpress 博客作为域的别名

www.domain.org/blog

为此,我们尝试使用以下别名设置虚拟主机:

<VirtualHost *:80>
       Alias /blog /var/apache-vhosts/www.domain.org-blog

       <Directory /var/apache-vhosts/www.domain.org-blog/>
           Options Indexes FollowSymLinks MultiViews
           AllowOverride All
           Order allow,deny
           allow from all
       </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

我们启用了 mod_alias apache 模块,但它只是不会拿起它。

有没有其他人做到了这一点?

我也试过在没有 vhost 包装标签的情况下包含别名,但仍然没有乐趣:/

wod*_*dka 6

你必须结合两者:

<VirtualHost *:80>
    ServerName domain.org
    ServerAlias www.domain.org

    ProxyPass /blog !
    Alias /blog /var/apache-vhosts/www.domain.org-blog

    <Directory /var/apache-vhosts/www.domain.org-blog/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined


    ProxyPass / http://localhost:8884/
    ProxyPassReverse / http://localhost:8884/
    ProxyPreserveHost on
    LogLevel debug
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)