How to Mongodb &virtual host
Jump to navigation
Jump to search
step : 1 Mongodb installation :
sudo rm /etc/apt/sources.list.d/mongodb*.list apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4 sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb- org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list' sudo apt update sudo apt install mongodb-org systemctl enable mongod.service systemctl start mongod.service mongo --version
step : 2 create virtual host :
sudo apt-get update sudo apt-get install apache2 sudo mkdir -p /var/www/example.com/html sudo chown -R $USER:$USER /var/www/example.com/html sudo chmod -R 755 /var/www vi /var/www/example.com/html/index.html
<html> <head> <title>Welcome to Example.com!</title> </head> <body> <h1>Success! The example.com virtual host is working!</h1> </body> </html>
Replace your host name and give proper document root . Do the same for backend also.
sudo vi /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/bfab_frontend/html
ServerName dashboard.iambfab.dance
ServerAlias www.dashboard.iambfab.dance
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace your host name and give proper document root . Do the same for backend also.
sudo a2ensite example.com.conf sudo a2dissite 000-default.conf sudo systemctl restart apache2
step 3 : install ssl
sudo apt-get update sudo apt-get install python-certbot-apache
We already created conf file so no need to create again , just run this command
sudo certbot --apache -d your_domain
choose noredirect option.
reference : mongodb >> https://stackoverflow.com/questions/34733340/mongodb-gpg-invalid-signatures virtual host >> https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04