Online admissions open for the SEO, web development and networking & cybersecurity courses. Enquire for the next batch.

Website Deployment: From Domain and Hosting to a Live HTTPS Site

5 min read Updated By the SkillNewton team

What is website deployment?

Website deployment is the process of moving a finished website from your computer to a server connected to the internet, so visitors can reach it through a domain name. It covers pointing DNS at the server, uploading code, setting production configuration, enabling HTTPS, preparing the database and planning backups, so that each later release is repeatable and safe.

Key deployment terms

  • Domain name: the human-readable address, such as example.in, that you rent yearly from a registrar.
  • DNS record: an entry that maps the domain to a server. An A record points to an IPv4 address, AAAA to an IPv6 address and CNAME to another hostname.
  • TTL (time to live): how long resolvers may cache a record before asking again. Lower it a day before you change servers so the switch spreads faster.
  • Document root: the folder the web server serves publicly, such as public/ in CodeIgniter or Laravel.
  • Environment: a copy of the site with its own settings, usually development, staging and production.
  • Release: one deployed version of the code, ideally tied to a Git commit or tag.

If DNS is new to you, read how DNS resolves a name to an address first; most "my site is not showing" problems after a launch are DNS or caching issues.

Shared hosting with cPanel vs a VPS

AspectShared hosting (cPanel)VPS
Server managementDone by the hostDone by you: updates, firewall, web server
AccessFile Manager, SFTP, sometimes SSH and GitFull root access over SSH
FlexibilityFixed PHP versions and limited extensionsInstall any software and configure freely
SuitsBrochure sites, small WordPress or PHP sitesCustom apps, queues, multiple sites, higher traffic
Skills neededBasicComfort with Linux commands and security hardening

Shared hosting is a sensible start because the host patches the operating system for you. A VPS gives control, but every security update becomes your responsibility.

Uploading code: Git versus SFTP

SFTP (file transfer over SSH) works everywhere, but manual uploads are easy to get wrong: a forgotten file or a half-finished upload can break the live site. Prefer plain SFTP over FTP, which sends passwords unencrypted.

A Git-based deploy is more reliable. The server pulls a known commit, so every release is traceable and easy to roll back. Keep your workflow from the Git and GitHub guide and deploy only from main or a tag.

ssh [email protected]
cd /var/www/myapp
git fetch --tags
git checkout v1.4.0
composer install --no-dev --optimize-autoloader
php spark migrate        # CodeIgniter 4; Laravel uses: php artisan migrate --force

Production configuration and HTTPS

Production settings differ from your laptop: errors must be logged, not shown, and credentials must come from the server, not from Git. Create the .env file directly on the server and restrict its permissions.

# .env on the production server (never committed)
CI_ENVIRONMENT = production
app.baseURL = 'https://example.in/'
database.default.hostname = localhost
database.default.database = myapp
database.default.username = myapp_user
database.default.password = change-me

HTTPS is expected on every site. Let's Encrypt is a free certificate authority whose certificates are short-lived, so renewal must be automated. On cPanel, the host usually provides AutoSSL or a Let's Encrypt button. On a VPS, Certbot obtains and renews certificates:

sudo certbot --nginx -d example.in -d www.example.in
sudo certbot renew --dry-run    # confirms automatic renewal will work

After HTTPS works, redirect all HTTP requests to HTTPS with a 301 and update the base URL so links and assets do not load over plain HTTP.

Databases, backups and zero-downtime basics

Use migrations (version-controlled schema changes) rather than editing tables by hand on the live server. Before running them, take a backup. For MySQL databases, mysqldump creates a consistent dump of InnoDB tables:

mysqldump --single-transaction -u myapp_user -p myapp > backup-2026-11-10.sql
mysql -u myapp_user -p myapp < backup-2026-11-10.sql   # restore
  • Back up the database and uploaded files on a schedule, and keep at least one copy off the server.
  • Test a restore regularly; a backup you have never restored is only a hope.
  • For near-zero downtime, deploy each release into its own folder, install dependencies there, then switch a current symlink with ln -sfn releases/v1.4.0 current and reload PHP-FPM so OPcache picks up the new code.
  • Write migrations that are backwards-compatible (add a column first, remove the old one in a later release) so old and new code can run briefly side by side.

A repeatable deployment checklist

  1. Run tests locally and merge to main; tag the release.
  2. Back up the database and uploaded files.
  3. Pull the tagged code on the server or upload the build over SFTP.
  4. Install production dependencies and run migrations.
  5. Clear or warm caches, then reload PHP-FPM or the web server.
  6. Check the home page, a form, the login and the error log. Keep the previous release ready for a rollback.

Moving an existing site to a new domain or URL structure also needs redirects; see migrating a site without losing search traffic.

Practical exercise: deploy a small PHP site with HTTPS

  1. Push a small PHP project with a public/ folder and a .env.example file to a Git repository.
  2. On a test server or hosting account you control, clone the repository outside the document root and point the domain or subdomain at public/.
  3. Create the .env file on the server, run composer install --no-dev, and run migrations.
  4. Issue a Let's Encrypt certificate, add an HTTP-to-HTTPS redirect, and run certbot renew --dry-run or confirm AutoSSL is active.
  5. Take a mysqldump backup, restore it into a second empty database, and confirm the row counts match.

You are done when the site loads over HTTPS, https://yourdomain/.env returns a 404 or 403, and you can redeploy with one documented set of commands. The Advanced PHP course practises this release process on real projects.

Common mistakes

  • Pointing the document root at the project folder instead of public/, which can expose .env and source code.
  • Leaving display_errors on in production, which shows file paths and queries to visitors.
  • Running migrations without a fresh backup, leaving no way back if a change fails.
  • Editing files directly on the live server, so the server and Git no longer match.
  • Forgetting to automate certificate renewal, so the site shows a security warning when the certificate expires.

Frequently asked questions

How long does a DNS change take to work?

It depends on the TTL of the old record and on resolver caches. Changes are often visible within minutes to a few hours; lowering the TTL in advance shortens the wait.

Do I need a VPS for a PHP or WordPress site?

No. Shared hosting runs most small PHP and WordPress sites well. Move to a VPS when you need custom software, background workers or more control.

What is a staging environment?

A private copy of the live site with production-like settings where you test a release before it reaches visitors. It should use its own database and must not be indexed by search engines.

Want to Learn This Properly?

The Advanced PHP Web Development & Full-Stack Application Development (Online) turns guides like this into practised skills, with projects on real websites.

WhatsApp Call Us Now

Free counselling

Send an Enquiry

Tell us which course you are interested in. We reply by email or phone with the next batch and how to enrol.

Protected by reCAPTCHA. Google Privacy and Terms apply.

We reply by email or phone within working hours. No spam.