首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache反向代理不向客户端呈现angular builds的javascript

Apache反向代理不向客户端呈现angular builds的javascript
EN

Stack Overflow用户
提问于 2019-12-24 18:10:12
回答 1查看 1.2K关注 0票数 3

我正在尝试实现反向代理为我的2个网站,但从其中一个不是渲染html。

下面是我的apache ssl配置文件

代码语言:javascript
复制
<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost
                ServerName xxxx.xxxx.org

                DocumentRoot /var/www/html
                ProxyPreserveHost off
                SSLProxyEngine On
                SSLProxyVerify none
                SSLProxyCheckPeerCN off
                SSLProxyCheckPeerName off
                SSLProxyCheckPeerExpire off
                <Proxy *>
                        Order deny,allow
                        Allow from all
                </Proxy>
                <Location />
                        ProxyPass https://localhost:3000/
                        ProxyPassReverse https://localhost:3000/
                </Location>
                <Location /app1>

                        ProxyPass  http://localhost:4200/
                        ProxyPassReverse  http://localhost:4200/

                </Location>

                # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
                # error, crit, alert, emerg.
                # It is also possible to configure the loglevel for particular
                # modules, e.g.
                #LogLevel info ssl:warn

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                # For most configuration files from conf-available/, which are
                # enabled or disabled at a global level, it is possible to
                # include a line for only one particular virtual host. For example the
                # following line enables the CGI configuration for this host only
                # after it has been globally disabled with "a2disconf".
                #Include conf-available/serve-cgi-bin.conf

                #   SSL Engine Switch:
                #   Enable/Disable SSL for this virtual host.
                SSLEngine on

                #   A self-signed (snakeoil) certificate can be created by installing
                #   the ssl-cert package. See
                #   /usr/share/doc/apache2/README.Debian.gz for more info.
                #   If both key and certificate are stored in the same file, only the
                #   SSLCertificateFile directive is needed.
                SSLCertificateFile      /etc/apache2/sites-available/ssl-certificate/xxxxxccc.crt
                SSLCertificateKeyFile  /etc/apache2/sites-available/ssl-certificate/xxxx.xxxx.org.key
                SSLCertificateChainFile /etc/apache2/sites-available/ssl-certificate/sf_bundle-g2-g1.crt

现在,我尝试使用https://xxx.fghjk.org/app1访问我的服务器,但它显示空白页面。我注意到这个页面不能加载由angular应用构建的java脚本文件。

任何相关的建议

EN

回答 1

Stack Overflow用户

发布于 2020-04-19 01:47:18

您面临的问题很可能是由于angular用来从index.html检索js和css文件的引用造成的。在像您这样的设置中,因此有必要在index.html中设置<base>标记。

在您的情况下,它需要是<base href="/app1">

有关如何适当设置基本url的更多详细信息或替代方案,请参阅https://angular.io/guide/deployment

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59467143

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档