简体   繁体   English

将 Angular 应用程序部署到服务器

[英]Deploy angular application to server

I have an angular application(9) back-end(python) which is needed to be deployed to the server.我有一个角度应用程序(9)后端(python)需要部署到服务器。 But i am not able to do that, I have used ng-build command to build file which is created inside in dist folder which has .js file with over 30 mb.但我无法做到这一点,我使用 ng-build 命令来构建在 dist 文件夹中创建的文件,该文件夹具有超过 30 mb 的 .js 文件。 When I uploaded the dist folder to the server, It is not working.当我将 dist 文件夹上传到服务器时,它不起作用。 Angular app is working fine in local server. Angular 应用程序在本地服务器上运行良好。 Hosting server :fastcomet.托管服务器:fastcomet。 I want to know the proper steps to host the angular application to server我想知道将 Angular 应用程序托管到服务器的正确步骤

You need to use any web server apache or nginx.您需要使用任何 Web 服务器 apache 或 nginx。 nginx block eg: nginx 块例如:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html/generated_angular_dist_folder;
        index index.html index.htm index.nginx-debian.html;

        server_name domain-name-tld;

        location / {
                try_files $uri $uri/ =404;
        }
}

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

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