Saturday, February 19, 2022

[SOLVED] Forbidden Angular 2 in Apache 2.4 on Centos 7

Issue

I try to deploy Angular 2 Webpack starter in my server centos 7 with Apache 2.4 but when i enter to the server domain ip from my laptop browser that send me a forbidden message.

Well the Angular 2 webpack was installed in /var/www/html/ directory and the document root from httpd.conf file is /var/www/html/src/ where are the index.html Angular 2 and i have the following config in httpd.conf file

<Directory />
AllowOverride All
Require all granted
</Directory>

<Directory "/var/www">
AllowOverride All
Require all granted
</Directory>

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Pls Help.

Regards.


Solution

first, you need build your app with command

# production (jit)
npm run build:prod
# AoT
npm run build:aot

after built successful, you got dist directory, you can rename it, then copy to html dir in /var/www/html

config apache with same config in your post.



Answered By - Tiep Phan
Answer Checked By - Gilberto Lyons (WPSolving Admin)