简体   繁体   English

不断收到错误503-A2Hosting上的Node.js应用

[英]Keep Getting Error 503 - Node.js app on A2Hosting

I have a node app that works perfectly on Heroku but not on A2Hosting nor on FastComet: 我有一个节点应用程序,可以在Heroku上完美运行,但不能在A2Hosting或FastComet上运行:

It is an express app using ejs. 这是一个使用ejs的快速应用程序。

The Routes are simply as follows: 路线简单如下:

//Root Route
app.get("/", function(req, res){
  res.render("index");
});

app.get("/contact", function(req, res){
    // res.send("You have reached the contact page");
    res.render("contact");
});

app.get("/about", function(req, res){
    // res.send("You have reached the contact page");
    res.render("about");
});

I keep getting an error 503 on the contact and about routes but the initial index.ejs works just fine: 我在联系人和路线上始终收到错误503,但初始index.ejs正常运行:

My .htaccess file is simply the following: 我的.htaccess文件仅是以下内容:

RewriteEngine On
RewriteRule ^$ http://127.0.0.1:49555/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:49555/$1 [P,L]
DirectoryIndex views/index.ejs

The App works perfectly on my localhost as well as on Heroku. 该应用程序可在我的本地主机以及Heroku上完美运行。 I have tried everything and cannot seem to come right with my links to contact.ejs and about.ejs. 我已经尝试了所有方法,但似乎无法正确显示我与contact.ejs和about.ejs的链接。

The tags are simply: 标签很简单:

<nav>
      <li><a href="/about">Samples</a> </li>
      <li><a href="/contact">Contact</a> </li>
    </nav>

The Index.ejs, contact.ejs and about.ejs are in a views folder. Index.ejs,contact.ejs和about.ejs在views文件夹中。

This is the actual site on A2Hosting: http://www.digital-alchemy.solutions 这是A2Hosting上的实际站点: http : //www.digital-alchemy.solutions

And This is the site on Heroku which works perfectly: https://desolate-lowlands-92367.herokuapp.com 这是Heroku上运行良好的网站: https : //desolate-lowlands-92367.herokuapp.com

Any Help would be seriously appreciated. 任何帮助将不胜感激。

Kind regards 亲切的问候

Wayne 韦恩

With amazing help from A2Hosting support staff, the problem was a missing line in the .htaccess file. 在A2Hosting支持人员的大力帮助下,问题在于.htaccess文件中缺少一行。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ views/$1.ejs [NC,L] <<<< This line was missing

RewriteEngine On
RewriteRule ^$ http://127.0.0.1:49555/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:49555/$1 [P,L]
DirectoryIndex views/index.ejs

According to their website, this error(503) can occur when resource limit is exceeded, meaning the site is exceeding the allowed resources on the server 根据他们的网站,当超出资源限制时,可能会发生此错误(503),这意味着该网站超出了服务器上允许的资源

Additionally, the error appears when: 此外,在以下情况下会出现错误:

  • Your account usage exceeds 35 simultaneous HTTP connections 您的帐户使用率同时超过35个HTTP连接
  • Your account usage exceeds predefined CPU or memory limits 您的帐户使用量超出了预定义的CPU或内存限制

if you'd like more information, I have provided the link where I got the info 如果您想了解更多信息,我提供了获取信息的链接

https://www.a2hosting.com/kb/a2-hosting-products/503-service-temporarily-unavailable-message https://www.a2hosting.com/kb/a2-hosting-products/503-service-temporarily-unavailable-message

Good luck ! 祝好运 !

Sorry to hear you're having issues with our services though it works on Heroku. 很抱歉,虽然它在Heroku上有效,但您在使用我们的服务时遇到问题。

If you email me (alex@a2hosting.com) with your primary domain name, client area email address or ticket ID, I can have our team look at what is causing the error to pop up and hopefully get to the bottom of this for you :). 如果您通过电子邮件(alex@a2hosting.com)向我发送电子邮件,并提供您的主要域名,客户区域电子邮件地址或票证ID,我们可以让我们的团队调查导致此错误的原因,并希望能为您提供帮助。 :)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM