Website Deployment

Learn to move a website from a local environment to a server.

Deployment is moving a website from a local environment to a server.

Connect to server

ssh root@ip

Install Apache2 on your server

sudo apt-get update

sudo apt-get install apache2

Add php libraris to send emails with a website php form

sudo apt-get install php libapache2-mod-php

apt-get install sendmail

Install git on your server

sudo apt-get install git

Create the directory structure

sudo mkdir -p /var/www/your_folder_name/public_html

Grant permissions

sudo chown -R $USER:$USER /var/www/your_folder_name/public_html

sudo chmod -R 755 /var/www

Get into your directory

cd /var/www/your_folder_name/public_html

Clone your project from your GitHub repo

git clone https://github.com/your_name_on_github/your_project_repo.git

Configure 000-default.conf file

sudo nano /etc/apache2/sites-available/000-default.conf

Add your path "/var/www/your_folder_name/public_html/your_project_repo" to index.html file to DocumentRoot


    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/your_folder_name/public_html/your_project_repo
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Restart Apache2 to make these changes take effect


    service apache2 restart

Go to browser use your ip address

Yelp Facebook LinkedIn YouTube Twitter Instagram