在本地构建并运行angular Universal之后,我尝试部署到apache服务器。我正在将dist文件夹移到公共html。
我运行node dist/server/main.js
,它从端口localhost:4000开始,当我卷曲localhost:4000时,我正在获取内容。
p.s。我还安装了pm2,当我尝试
pm2 start dist/server/main.js
启动服务器时,但是当我尝试卷曲时,它显示内部服务器错误
我还编辑了.conf文件以代理到localhost:4000:
ProxyPreserveHost On
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/
当我尝试访问时显示
vhost文件
DocumentRoot /var/www/domain/public/dist/browser
<Directory /var/www/domain>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain [OR]
RewriteCond %{SERVER_NAME} =domain
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ProxyPreserveHost On
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/
答案 0 :(得分:0)
由于我使用的是Let's Encrypt CA,因此它将在/etc/apache2/sites-available
yourdomain-le-ssl.conf
因此从yourdomain.conf
文件代理到localhost:4000的配置不正确,从yourdomain-le-ssl.conf
代理的访问是正确的