Hosting PHP Website on Digital Ocean with simple step
Here are the general steps to host a PHP website on DigitalOcean:
- Sign up for a DigitalOcean account and create a new Droplet. You can choose any Linux distribution, but Ubuntu is a popular choice.
- Connect to your Droplet via SSH. You can use a tool like PuTTY on Windows or the terminal on macOS and Linux.
- Once connected, update your package list by running
sudo apt-get update. - Install the Apache web server by running
sudo apt-get install apache2. - Install PHP and the Apache PHP module by running
sudo apt-get install php libapache2-mod-php. - Create a new directory for your website in the default Apache document root by running
sudo mkdir /var/www/example.comandsudo chown -R $USER:$USER /var/www/example.comwhere example.com is your website name. - Create a new virtual host file for your website by running
sudo nano /etc/apache2/sites-available/example.com.confand configure it accordingly. - Enable the new virtual host by running
sudo a2ensite example.com.conf. - Restart Apache to apply the changes by running
sudo service apache2 restart - Put your PHP files inside the new directory and access your website via a web browser by entering your Droplet’s IP address or domain name.
You should also consider securing your website and server, such as creating backups and securing with SSL, etc.
Get Jupiter Smith’s stories in your inbox
Join Medium for free to get updates from this writer.
Note: These steps are the basic instructions to get a basic PHP site running on Digital Ocean. You might need to make more configuration for your specific requirements.







