Anahita Project

Anahita Project's Articles

Rajkumar Mundel

Rajkumar Mundel

May 04 2020

Setup Anahita-React and Anahita Backend as API on Digital Ocean

Setup Anahita Backend on Ubuntu 18.04.3 (LTS) x64 (Digital Ocean)

Step 1. Setup LAMP on Ubuntu 

sudo apt update

Install Apache2

sudo apt install apache2

sudo ufw app list

sudo ufw app info "Apache Full"

sudo ufw allow in "Apache Full"

Install MySQL

sudo apt install mysql-server

sudo mysql_secure_installation (When you do this, Just read and provide information what it ask for)

This step is to change password from Auth_Socket to Native.

sudo mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypassword';


SELECT user,authentication_string,plugin,host FROM mysql.user;


Install PHP

sudo apt install php libapache2-mod-php php-mysql

sudo nano /etc/apache2/mods-enabled/dir.conf  (This step is to ensure 1st time lookup by Apache should "index.php". Move Index.php to front)

Install PHPMyAdmin

sudo apt install phpmyadmin php-mbstring php-gettext

Make sure you select Apache2 when phpmyadmin installation ask. When the prompt appears, “apache2” is highlighted. Hit SPACE, TAB, and then ENTER to select Apache.

sudo phpenmod mbstring

sudo systemctl restart apache2

To access mysql, use this - sudo mysql -u root -p

Open http://your_domain_or_IP/phpmyadmin and check.

Step 2. Setup Anahita Backend

git clone

cd anahita

curl -s | php

sudo apt-get install zip unzip

sudo apt install composer

composer update

php anahita site:init

This will ask Database Name, Database Username, Password, host, port and table prefix. Provide as your need.

http://yoursite/people/signup  (Before you hit this, you need to Setup Virtual Host)

Step 3. Setup Virtual Host (Apache2)

Make a copy of 

/etc/apache2/sites-available/000-default.conf and give name as your Website

For Example 

cd /etc/apache2/sites-available

cp 000-default.conf

Edit and change the DocumentRoot to /var/www/YourWebsiteName

Enable the conf file

sudo a2ensite

Diable the default conf file

sudo a2dissite 000-default.conf

Check the conf file

sudo apache2ctl configtest

Restart the server

sudo systemctl restart apache2

Create Symbolink Now which will point to www folder which is created when we installed the Anahita

cd /var/www

ln -s /mundel/anahita/www

sudo chmod -R 777 /mundel/anahita/www

Restart the Server - sudo systemctl restart apache2

Step 4. Setup mail confiiguration with Admin user. I suggest use SendInBlue for that.


Setup Anahita ReactJS on Ubuntu 18.04.3 (LTS) x64 (Digital Ocean)

Step 1. Install NodeJs

curl -sL | sudo -E bash -

sudo apt-get install -y nodejs

Step 2. Install NPM

npm install npm@latest -g

Step 3. Clone Anahita React project from github

git clone

Step 4. go to react folder and type - npm install

Step 5. npm start


Now Setup CORS on Server so that React and AnahitaBackend can share data with each other.

Helping URL -

cd /etc/apache2

Open apache2.conf and go to end of the file and add below lines.

Header set Access-Control-Allow-Origin ""

Header set Access-Control-Allow-Methods "POST, GET, DELETE, PUT, PATCH, OPTIONS"

Header set Access-Control-Allow-Headers "Content-Type, Authorization"

Header set Access-Control-Allow-Credentials true

a2enmod headers

apachectl -t

sudo service apache2 reload

sudo systemctl restart apache2


Thank you


Whatsapp Number - 0091-7976828588

#Anahita #AnahitaReact #DigitalOcean #BackendAPI #ClientServerArchitecture

Rastin Mehr liked this
Excellent work @rmundel thank you very much for your contribution. I added some hashtags to your article too.
Rajkumar Mundel liked this
My pleasure :)

Additional Information

Powered by Anahita