cd reactappfolder
npm run build
sudo chown www-data:www-data -R productionfolder/
<VirtualHost *:9876>
#ServerName http://avpathak1-lnx.cisco.com:8000
ServerName mysite.com
ServerAlias localhost
# SSLEngine on
# SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
# SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
#SSLCACertificateFile /var/www/ssl/AAACertificateServices.crt
# ProxyPreserveHost On
# SSLProxyEngine On
# SSLProxyCheckPeerCN on
# SSLProxyCheckPeerExpire on
# ProxyPass /app_fix http://127.0.0.1:8080/
# ProxyPassReverse /app_fix http://127.0.0.1:8080/
# ProxyPass /fix_server http://127.0.0.1:8080/fix_server
# ProxyPassReverse /fix_server http://127.0.0.1:8080/fix_server
LogLevel info
WSGIScriptAlias /api /home/ko/djangoserver/apachereactdjango/djangoserver/djangoserver/wsgi.py
WSGIDaemonProcess myprocessname processes=5 threads=10 display-name=%{GROUP} python-home=/home/ko/djangoserver/djangoser
WSGIProcessGroup myprocessname
WSGIApplicationGroup %{GLOBAL}
#path to parent folder where both client and server dirs are present(this parent folder must have all necessary permissions required by apache)
<Directory /home/ko/djangoserver/apachereactdjango>
AllowOverride all
Options +Indexes
Require all granted
Allow from all
</Directory>
ErrorLog /home/ko/djangoserver/error.log
CustomLog /home/ko/djangoserver/access.log combined
DirectoryIndex index.html
# ErrorDocument 400 https://localhost:8888/
# Static files location (_example: react build folder path)
DocumentRoot /home/ko/djangoserver/apachereactdjango/build/
# Django built static files (templates) folder
# Alias /djangostatic /var/www/docker_installer/frontend/build/django/static
Protocols h2 h2c http/1.1
</VirtualHost>
sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
sudo vim /etc/apache2/site-available/mynew.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest # it will return syntax OK, if there are no erros
sudo a2ensite mynew.conf
sudo apache2ctl restart or sudo systemctl reload apache2
hostname -I
vim /etc/hosts
example:
cat /etc/hosts
127.0.0.1 localhost
129.0.1.1 ko
131.0.1.1 mynewsite.com
cat /etc/apache2/ports.conf
Listen 80
#ADDED LISTEN 9876 LINE TO REGISTER 9876 PORT FOR VIRTUAL HOST, AND USED THE SAME PORT IN mynew.conf FILE
Listen 9876
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
.
.
.
.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)