Installing WordPress on DigitalOcean

4rer43

In this tutorial, We have to learn how to install WordPress on DigitalOcen.Just Follow this given step.


Step: 1

First We have to need to create a droplet in DigitalOcean.Please refer this How to create Droplet in the digital ocean. When the droplet is created, you will receive mail similar to the given screenshot.


Step: 2

After receiving the email, Open the WordPress server using a given IP Address in the browser. Like that,

In this screenshot, WordPress run successfully using the given IP Address. Now, Run the default index.html file. So, we need to change the root directory and run our WordPress project.


Step: 3

run the following command

C:\Users\Admin> ssh root@IP_Address
root@IP_Address password: Enter Password...
Generate New Password...

Go to the HTML directory path, using the run following command

root@Amsterdam-Server:~# cd /var/www/html

Now, make the directory in the /var/www/html/ folder

root@Amsterdam-Server:~# mkdir /var/www/html/blog-wordpress

Here, blog-WordPress is a directory name. which you want to be created.


Step: 4

Now, Copy the local WordPress project into the blog-WordPress folder to DigitalOcen. Clone the local project on bitbucket using the run following command.

first, go to the blog-WordPress folder and after clone the project

root@Amsterdam-Server:~# cd /var/www/html
root@Amsterdam-Server:/var/www/html# git clone https://abcd@bitbucket.org/abcd/blog-wordpress.git
enter your bitbucket password......

Now go to the folder path

root@Amsterdam-Server:/var/www/html# cd /blog-wordpress

Step: 5

You copied your WordPress project into the DigitalOcen server.

Now, we need to site configuration. Run the following command

root@Amsterdam-Server:/var/www/html/blog-wordpress# sudo nano /etc/apache2/sites-available/000-default.conf

In the above command open the 000-default.conf file and add the following code in this file

ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/blog-wordpress/
        ServerName domain_name.com
        <Directory />
                Options FollowSymLinks
                AllowOverride None
       </Directory>
      <Directory /var/www/html/blog-wordpress/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Require all granted
        </Directory>

Insert the above code and save the file. After running the following command

root@Amsterdam-Server:/var/www/html/blog-wordpress# sudo service apache2 restart
root@Amsterdam-Server:/var/www/html/blog-wordpress# sudo systemctl restart apache2

Step: 6

Now, Export your WordPress local database and import it into the Live database

Go the http://localhost/phpmyadmin/ URL and choose your WordPress database and goto the Export menu and export the database.



After the Export database, Open the database .sql file into any text editor like notepad ++ or sublime text.

Find the http://127.0.0.1/wordpress_poject_folder_name in the .sql file

and replace all local path your domain name like http://www.example.com

Open the live database in the browser like that,

http://domain_name/phpmyadmin/

After creating a new database and import the.sql file in the live PHPMyAdmin database.

after, run the following command,

sudo service apache2 restart

Now, Run in the browser http://www.example.com

Thank You.


Conclusion

Thank you for reading this article.! Let me know your thoughts.
If you enjoyed this article you might also want to check out the create droplet in digital ocean article.

About Dhaval Shah

My name is Dhaval Shah. I'm a PHP developer, entrepreneur and CEO of DAG inventions PVT ltd. I live in India and I love to write tutorials and tips that can help other developers. I am a big fan of PHP, Java-script, JQuery, Laravel, WordPress and Bootstrap.
Follow me on Github / Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!