1、首先在本地保证代码能跑起来,没有错误
2、在本地可以ng build编译打包(这里其实就是编译成静态文件)
3、ng build会生成dist文件夹。将dist上传到服务器上的路径是:/var/www/html
4、cd /etc/apache2 这里面有一个apache2.conf文件
5、vi apache2.conf
#<Directory />
# Options FollowSymLinks
# AllowOverride None
# Require all denied
#</Directory>
#<Directory /usr/share>
# AllowOverride None
# Require all granted
#</Directory>
<Directory /var/www/html/dist>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
除了下面的/var/www/html/dist 对应的Directory 其它的Directory 都注释掉
6、service apache2 start 启动
service apache2 stop 停止
service apache2 restart 重启