Monday, 26 September 2022

docker-compose httpd with angular CCLI deployment

 1) httpd.conf

have the following in httpd.conf


#

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.

#

# User/Group: The name (or #number) of the user/group to run httpd as.

# It is usually good practice to create a dedicated user and group for

# running httpd, as with most system services.

#

User www-data

Group www-data


# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

#

DocumentRoot "/usr/local/apache2/htdocs"

<Directory "/usr/local/apache2/htdocs">

    #

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.4/mod/core.html#options

    # for more information.

    #

    Options Indexes FollowSymLinks


    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   AllowOverride FileInfo AuthConfig Limit

    #

    AllowOverride None


    #

    # Controls who can get stuff from this server.

    #

    Require all granted

</Directory>


2) Have the following in your mapped virtual host site file my-site-ssl.conf

        # specified in httpd.conf as default

DocumentRoot /usr/local/apache2/htdocs/myDeployedSite


3) ensure angular dist folder have 750 , and yourUser:www-data because www-data is the group going to access this folder listed above(we use yourUser here altough it does not exist in docker-container, so docker will use its current userid , but we want to have this so you can access in your directory),  map angular dist folder to /usr/local/apache2/htdocs/myDeployedSite in docker-compose. (NOTE, when you map a directory/file as volume to docker directory/file, not only the directory/file will be created if it does not exist, also its directory/file location will be inherited, if user/group copied does not exist in docker-container, docker-container will use its current user)

sudo chown yourUser:www-data -R  ~/angular/cli/dist/myDeployedSite/*

sudo chmod 750 -R  ~/angular/cli/dist/myDeployedSite/*


docker-compose.yml"

services:

  httpd:

    image: httpd:latest

    ports:

      - "80:80"

      - "443:443"

    volumes:

      - ~/angular/cli/dist/myDeployedSite:/usr/local/apache2/htdocs/myDeployedSite



No comments:

Post a Comment