Friday, February 18, 2022

To Make Smart Apache Virtual Host File

We will add some entry's in envvars file for virtual host in from variables.


1)  vim /etc/apache2/envvars

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
## /etc/default/locale
export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1
# env hitgis

#ServerName ${EK_DOMAIN} 

###Note- Only Add Those Variable Which you Require  

export Demo_PROJECTNAME=Demo-Project
export Demo_DOMAIN=demo.com
export Demo_PATH=/var/www/html/
export Demo_POSTGRES_SERVER=localhost
export Demo_POSTGRES_DB=pgdb
export Demo_POSTGRES_USER=postgres
export Demo_POSTGRES_PASS=postgres
export Demo_VERSION=1.0.0
export Demo_HTMLPASS=true
export Demo_PROTOCOL=https
export Demo_PRODUCTION=false
export Demo_BACKUP_LOCATION=hitbackup@backup.demo.com:/opt/hitbackup/
export Demo_BACKUP_PASS=iut0703iut0703
export Demo_DOCKERBASE=webgis-base20.04
export Demo_DOCKERFILE=webgis-full20.04
export Demo_LINUX=20.04
export Demo_POSTGRES_PORT=9536
export Demo_SSH_PORT=10036
export Demo_GEOSERVER=false
export Demo_TYPE=webgisserver
export Demo_SERVER=qgem
export Demo_INSTALL=/opt/hitgis-install
export Demo_SYS=/hg/sys
export Demo_VAR=/hg/var
export Demo_PRJ=/hg/prj
export Demo_WEBGIS_PORT=443
export Demo_SSH_PORT=22
export Demo_POSTGRES_PORT=5432
export Demo_SYSBIN=/hg/sys/bin
export Demo_SYSPYLIB=/hg/sys/pylib
export Demo_DOCKER=0
export PYTHONPATH="/hg/prj/rest:/hg/prj/rest/endpoints:/hg/prj/pylib:/hg/sys/pylib"
export PATH="/hg/prj/bin:/hg/sys/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"


2) vim /etc/apache2/site-available/000-default.conf

<VirtualHost *:${Demo_WEBGIS_PORT}>

ServerAdmin webmaster@localhost
ServerName ${Demo_DOMAIN}

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

DocumentRoot ${Demo_PATH}

ProxyPass /login http://127.0.0.1:3000
ProxyPassReverse /login http://127.0.0.1:3000

<Proxy http://127.0.0.1:3000>
    Require all granted
    Options none
</Proxy>

ProxyPass /admin http://127.0.0.1:3001
ProxyPassReverse /admin http://127.0.0.1:3001

<Proxy http://127.0.0.1:3001>
    Require all granted
    Options none
</Proxy>

</VirtualHost>

No comments:

Post a Comment

testing