Cpanel中的角度SSR部署

问题描述 投票:0回答:1

我正在尝试在Cpanel上部署一个角度通用项目,我上传了文件并安装了它

在子目录public_html / aqar_front中,我使用以下代码在htaccess中添加了htaccess:>

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

然后我运行此命令

npm run serve:ssr 

在浏览器中工作正常

enter image description here

但是,正如您所知,当我关闭终端时,应用程序停止了,因此我使用pm2使其保持运行,但在浏览器中无法正常工作enter image description here

我使用了此命令

pm2 start  dist/server.js  -- --port 4000

但是它无法从浏览器中获得任何帮助,请这是我的角度和节点js版本

Angular CLI:8.3.4节点:12.13.1操作系统:Linux x64角度:8.2.6

我正在尝试在Cpanel上部署一个有角度的通用项目,我上传了文件并将其安装在public_html / aqar_front子目录中,并使用以下代码在htaccess中添加了htaccess ...

node.js angular cpanel angular-universal
1个回答
0
投票

对于任何遇到此问题的人,我都运行local.js而不是server.js

© www.soinside.com 2019 - 2024. All rights reserved.