NextJS Apache部署无法访问API路由

时间:2020-11-04 21:01:57

标签: node.js linux apache next.js

我的API路由无法正常工作

“无法加载资源:服务器响应状态为500(代理错误)”-尝试访问相对URL / api /任何内容

“获取https://FULLURL.HERE/api/whatever 500(代理错误)”

我不太确定这里发生了什么,所有帮助都将得到赞赏

这是我的Apache网站-可用的配置

<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com



ServerName server.example.com
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia Full
    <Proxy *>
        Require all granted
    </Proxy>
    ProxyPass /api https://127.0.0.1:3000/
    ProxyPassReverse /api https://127.0.0.1:3000/

    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/

  SSLEngine On
  SSLProxyEngine On

        # 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 /error.log
        CustomLog /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


SSLCertificateFile /etc/letsencrypt/live/server.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/server.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

0 个答案:

没有答案