{"id":21339989,"url":"https://github.com/iron-chest/deploying-wordpress-to-an-amazon-ec2-instance","last_synced_at":"2025-06-21T01:37:41.565Z","repository":{"id":236944586,"uuid":"793481401","full_name":"Iron-chest/Deploying-WordPress-to-an-Amazon-EC2-Instance","owner":"Iron-chest","description":"Deploying WordPress to an Amazon EC2 instance","archived":false,"fork":false,"pushed_at":"2024-05-02T14:36:26.000Z","size":377,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T15:26:16.667Z","etag":null,"topics":["amazon-web-services","apache2","ec2-instance","mysql-database","php8","wordpress"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Iron-chest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-29T09:55:42.000Z","updated_at":"2024-05-02T14:36:29.000Z","dependencies_parsed_at":"2024-04-29T11:03:52.758Z","dependency_job_id":"e77704b8-f9c9-4eec-8ebf-66aefbbaa2f9","html_url":"https://github.com/Iron-chest/Deploying-WordPress-to-an-Amazon-EC2-Instance","commit_stats":null,"previous_names":["iron-chest/-deploying-wordpress-to-an-amazon-ec2-instance"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-chest%2FDeploying-WordPress-to-an-Amazon-EC2-Instance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-chest%2FDeploying-WordPress-to-an-Amazon-EC2-Instance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-chest%2FDeploying-WordPress-to-an-Amazon-EC2-Instance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-chest%2FDeploying-WordPress-to-an-Amazon-EC2-Instance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Iron-chest","download_url":"https://codeload.github.com/Iron-chest/Deploying-WordPress-to-an-Amazon-EC2-Instance/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817321,"owners_count":20352537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-web-services","apache2","ec2-instance","mysql-database","php8","wordpress"],"created_at":"2024-11-22T00:48:42.955Z","updated_at":"2025-03-16T02:41:26.594Z","avatar_url":"https://github.com/Iron-chest.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploying WordPress to an Amazon EC2 Instance\n\n## WordPress\nWordPress is a web content management system. It was originally created as a tool to publish blogs but has evolved to support publishing other web content, including more traditional websites, mailing lists and Internet forum, media galleries, membership sites, learning management systems and online stores.\n\n## Amazon EC2 Instance\nAmazon Elastic Compute Cloud is a part of Amazon.com's cloud-computing platform, Amazon Web Services, that allows users to rent virtual computers on which to run their own computer applications.\n\n### Step 1: Launch and configure an Ubuntu Amazon EC2 instance\n\n1. Sign in into your AWS Console and Click on EC2\n\n2. Navigate to the EC2 Dashboard and Launch Instance\n\n3. Choose the Server Name.\n![Choosing the Server Name](./Images/server1.png)\n\n4. Choose the Amazon Machine Image.\n![Choosing the Amazon Machine Image](./Images/server2.png)\n\n5. Choose the Instance type and KeyPair\n![Choosing the Amazon Machine Image](./Images/server3.png)\n\n6. Configure the Network Settings\n![Choosing the Amazon Machine Image](./Images/server4.png)\n\n7. Configure Storage for the EC2 Instance\n![Choosing the Amazon Machine Image](./Images/server5.png)\n\n8. Then, Click on Launch Instance and the server should be running.\n![Choosing the Amazon Machine Image](./Images/server6.png)\n\n### Step 2: Connecting to the EC2 Instance\n1. Click on your Public IPv4 address\n2. I would be using a ssh-client called Mobaxterm to access my EC2 Instance\n3. [Download Mobaxterm](https://mobaxterm.mobatek.net/download.html)\n\n4. Login your EC2 Instance using:\n- Public IpAddress\n- Private Key (.pem)\n- Server Name (Ubuntu)\n\n### Step 3: Download Apache, PHP, MySQL.\n1. Make sure your server is updated\n```\nsudo apt-get update\n\n```\n\n2. Install Apache server on Ubuntu\n``` \nsudo apt install apache2 -y\n\n```\n\n3. Install php runtime and php mysql connector\n```\nsudo apt install php libapache2-mod-php php-mysql -y\n\n```\n\n4. Install MySQL server\n```\nsudo apt install mysql-server -y\n\n```\n### Step 4: Creating and Configuring MySQL Database\n1. Login to MySQL server\n```\nsudo mysql -u root\n\n```\n\n2. Change authentication plugin to mysql_native_password (change the password to something strong)\n```\nALTER USER 'root'@localhost IDENTIFIED WITH mysql_native_password BY 'Your Password';\n\n```\n\n3. Create a new database user for wordpress (change the password to something strong)\n```\nCREATE USER 'UserName'@localhost IDENTIFIED BY 'Password';\n\n```\n\n4. Create a database for wordpress\n```\nCREATE DATABASE wp;\n\n```\n\n5. Grant all privilges on the database 'wp' to the newly created user\n```\nGRANT ALL PRIVILEGES ON wp.* TO 'UserName'@localhost;\n\n```\n### Step 5: Download WordPress and configure it \n1. Download the latest Wordpress archive file\n```\ncd /tmp\nwget [Lastest Wordpress version](https://wordpress.org/latest.tar.gz)\n\n```\n\n2. Unzip the Wordpress archive file \n```\ntar -xvf latest.tar.gz\n\n```\n\n3. Move wordpress folder to apache document root\n```\nsudo mv wordpress/ /var/www/html\n\n```\n\n4. Command to restart/reload apache server\n```\nsudo systemctl restart apache2\n\n```\nOR\n```\nsudo systemctl reload apache2\n\n```\n\n5. Sign in the wordpress website using (http://ipaddress/wordpress/)\n\n6. Login using the required credentials like password, username e.t.c\n\n7. To configure the wp-config.php file\n```\nsudo vim wp-config.php\n\n```\n8. and paste this details\n\n```\n\u003c?php\n/**\n * The base configuration for WordPress\n *\n * The wp-config.php creation script uses this file during the installation.\n * You don't have to use the website, you can copy this file to \"wp-config.php\"\n * and fill in the values.\n *\n * This file contains the following configurations:\n *\n * * Database settings\n * * Secret keys\n * * Database table prefix\n * * ABSPATH\n *\n * @link https://wordpress.org/documentation/article/editing-wp-config-php/\n *\n * @package WordPress\n */\n\n// ** Database settings - You can get this info from your web host ** //\n/** The name of the database for WordPress */\ndefine( 'DB_NAME', 'wp' );\n\n/** Database username */\ndefine( 'DB_USER', 'Promise' );\n\n/** Database password */\ndefine( 'DB_PASSWORD', 'Ironchest@567.' );\n\n/** Database hostname */\ndefine( 'DB_HOST', 'localhost' );\n\n/** Database charset to use in creating database tables. */\ndefine( 'DB_CHARSET', 'utf8mb4' );\n\n/** The database collate type. Don't change this if in doubt. */\ndefine( 'DB_COLLATE', '' );\n\n/**#@+\n * Authentication unique keys and salts.\n *\n * Change these to different unique phrases! You can generate these using\n * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.\n *\n * You can change these at any point in time to invalidate all existing cookies.\n * This will force all users to have to log in again.\n *\n * @since 2.6.0\n */\ndefine( 'AUTH_KEY',         'J:\u003cB|v6{Ydym?UN(..+GYskwi^-%\u003cjH.zPw93t2$whwMcO!4 9mVx*^aOU?B0\u003c*|' );\ndefine( 'SECURE_AUTH_KEY',  ';oDzNS8F(-/@^=yR6./NqBx/I Z8XN6Hp+gPbqzsJi\u0026g^SQ.erJ;S\u003c!@6v:=b5h ' );\ndefine( 'LOGGED_IN_KEY',    '}R_ZBLMA6ne]r:{{(`^Wf(rK!tT+dinPrTR-o7w`70yM@2O}A,#5SQ3mW(:shsRA' );\ndefine( 'NONCE_KEY',        'ahzn/qc Y:xf|WFv}85F^FK`f0fDavBkPMB6#H4D./,`A,(7=E[6 vfR@1QPH%e)' );\ndefine( 'AUTH_SALT',        '1:P7#@Mn#W-%GOp3I1=r$Sniexxl\u003cj~o47?hS[OvSmvt+;pY]n6mI[-EElubdRt~' );\ndefine( 'SECURE_AUTH_SALT', '_m-~ANQmdA}f?}ijpj4eT\u003e0\u003e3ubw\u003cDQ[/q}V ;]+w,3-_^CWJj17\u0026w=\u0026[P96%L25' );\ndefine( 'LOGGED_IN_SALT',   'w6!$E{5dt]#x:a1%;-@q`4U%G+6c; #8nfkk?sP\u00268g1~#cDIC1!*p,a*IhsvRePa' );\ndefine( 'NONCE_SALT',       'ycZ\u00263_^|p:PV4I:xgG;LeM=4-r1Mf]fWr4aGeJ|ulTf\u003czwxsgf.*wQ-\u003cRG9}O8V^' );\n\n/**#@-*/\n\n/**\n * WordPress database table prefix.\n *\n * You can have multiple installations in one database if you give each\n * a unique prefix. Only numbers, letters, and underscores please!\n */\n$table_prefix = 'wp_';\n\n/**\n * For developers: WordPress debugging mode.\n *\n * Change this to true to enable the display of notices during development.\n * It is strongly recommended that plugin and theme developers use WP_DEBUG\n * in their development environments.\n *\n * For information on other constants that can be used for debugging,\n * visit the documentation.\n *\n * @link https://wordpress.org/documentation/article/debugging-in-wordpress/\n */\ndefine( 'WP_DEBUG', false );\n\n/* Add any custom values between this line and the \"stop editing\" line. */\n\n\n\n/* That's all, stop editing! Happy publishing. */\n\n/** Absolute path to the WordPress directory. */\nif ( ! defined( 'ABSPATH' ) ) {\n\tdefine( 'ABSPATH', __DIR__ . '/' );\n}\n\n/** Sets up WordPress vars and included files. */\nrequire_once ABSPATH . 'wp-settings.php';\n\n\n```\n9. To configure WordPress to be able to access it form the ipaddress rather than the ipaddress/wordpress\n```\ncd /etc/apache2/sites-available/\nls\nsudo vim 000-default.conf\n\n```\n\n10. Edit the 000-default.conf file\n```\nDocumentRoot /var/www/html/wordpress\n\n```\n\n#### 6. Reboot apache to adopt new changes\n1. Restart apache \n```\nsudo systemctl restart apache2\n\n```\n2. Access your Website on the Server Ip Address (http://IpAddress)\n\u003c!-- \n1.  Install certbot\n```\nsudo apt-get update\nsudo apt install certbot python3-certbot-apache\n\n```\n\n\n17. Request and install ssl on your site with certbot\n```\nsudo certbot --apache\n\n``` --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firon-chest%2Fdeploying-wordpress-to-an-amazon-ec2-instance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firon-chest%2Fdeploying-wordpress-to-an-amazon-ec2-instance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firon-chest%2Fdeploying-wordpress-to-an-amazon-ec2-instance/lists"}