Coder Social home page Coder Social logo

wordpress-amazon-ec2's Introduction

wordpress-amazon-ec2

This is a way to make a free wordpress website hosted on Amazon.

It uses a free-tier Amazon ec2 instance to host a site on Wordpress, with a Cloudflare DNS for advanced DDOS protection and other features, and the domain name can be taken from a few different places. ##Here are the steps:

  1. Create an AWS account (https://aws.amazon.com/). If you already have one with an ec2 instance running, I suggest you make a new account to avoid having the instance cost money. Use a throw-away email like from mailinator: (https://www.mailinator.com/), but make the username obscure (joshuaN8wPryqNG5YjjcjP) to avoid other people from finding / using your username. Alternatively you can create another gmail account, but that is a hassle. You can only have one ec2 instance running per account to stay within the free-tier limits of 750 hours / month (https://aws.amazon.com/free/). Put in a credit / debit card for payment, but don't worry - if you do this right you won't be charged at all. You need the card on file, though.
  2. Once you have created your account search for EC2 in services. It should say you need to wait 24 hours or so in order for the account to verify your payment method, so that's fine, just wait.
  3. While your AWS account is verifying, create a cloudflare account (https://www.cloudflare.com/). You can use the same account for all of your websites, so use your regular email.
  4. At this point, you need to pick a domain. There are 2 good options. 1st is to buy a domain from something like namecheap (https://www.namecheap.com/). Never use Godaddy except for verifying if a name is taken. Godaddy is the worst. Trust me. I usually use namecheap because it is the cheapest. 2nd option: Get a free domain from freenomm (http://www.freenom.com/). This works really well, and gives you a .tk or .ml etc. domain. If you want something very cheap, use this. I ended up getting a .tech domain from namecheap because it was on sale.
  5. Once you have a domain, navigate to the domain's settings (manage domain). Go to the nameservers area.
  6. Back on Cloudflare, click the Add Site button, and then type in the domain you just got. Click through everything, checking ok to the defaults, and at the last page it will ask for you to change the nameservers for the site. Copy the nameservers from Cloudflare and paste them into the nameservers from the place you bought your domain. Make sure you have selected the custom nameservers option. When that is entered, go back to cloudflare and press finish, navigating to the DNS page. Wait until Cloudflare verifies the nameserver, to ensure that it is the DNS.
  7. With cloudflare linked, you are done with your domain registrar so you can close that. Then delete all of the entries under the DNS records on cloudflare, if there are any. What I usually do for personal websites now is create a custom email, i.e. [email protected]. The only free way I know of to do this right now is to use Zoho mail (https://www.zoho.com/). Navigate to that site. I followed these instructions (https://www.zoho.com/mail/help/complete-guide-to-setup-zohomail.html), and they are always up to date. Make sure you make the necessary changes to your DNS records for verification. It is pretty self-explanatory. The only downside to using Zoho is there is no email forwarding, so take it or leave it.
  8. Now to configure ec2, you need to have your aws account verified. So wait until that happens. We will be using an Amazon AMI instance. Click Instances, Launch Instance, and then the first selection Amazon Linux AMI ... Then cick the free-tier version, configure instance details, add storage, leave as default. Add tags if you want. For configure Security group, add rule HTTP and HTTPS. Call the security group something easy to remember. Then launch create a new key pair, which essentially is the key to using the instance, and then launch the instance. THe key pair should be downloaded. Save the key in a safe and secure place on your computer.
  9. With your instance created, name it. Then go to Elastic IPs and click Allocate new Address. Allocate. Name it. Then go to actions, associate address, and choose your instance and the ip given. Make sure you do not leave unassociated elastic ips stored, because each address not associated costs money too. Be careful.
  10. With that configured, move back to instances and go to actions - connect. I usually ssh from terminal, or cmd on windows, but you can use a javascript client if you want. Open terminal or cmd, and type ssh -i "path-to-key.pem" [email protected]. The instructions there are also self-explanatory, and there is plenty of documentation.
  11. Now, having connected to your instance, I am going to refer you to the documentation, as that has the most up-to-date info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html. Use https. Just do it. It makes your site much more secure. After step 5, there's an optional secure your web server thing. Follow that link (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-an-instance.html) and complete only steps 1-3. That's all you need when using a cloudflare certificate. Steps 1-3. Then skip to step 4, and restart apache.
  12. Finish the LAMP stack info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html.
  13. Go back to cloudflare and under DNS records you should see your MX records for mail if you set that up. If you didn't, you should have nothing there. Add two CNAME records, one with www and the other with @ as the name. Set the domain name to your domain for the www record, and to your AWS DNS domain for the @ record. The AWS DNS can be found under your aws tab - instances - description. After saving changes and waiting a little bit, you should see the apache start page when you go to your purchased domain, showing that the ec2 instance is connected through cloudflare. You can configure the rest of cloudflare at this point. This is what I have set on cloudflare: DNSSEC on, SSL Full, Always use HTTPS on, Authenticated Origin Pulls on, Require Modern TLS on, Opportunistic Encryption on, TLS 1.3 enabled, universal SSL on, security level high, challenge pass 30 min, auto-minify on, Brotli on, accelerated mobile links on, google analytics plugin. Basically everything that works and is free I have activated. Just make sure your website still works when activated.
  14. Complete this documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html.
  15. So when you're finished you should have your wordpress website up. THere may be problems with https, in which case I go into the wordpress folder over ssh, sudo nano wp-config.php, and use define('WP_HOME','http://example.com'); and define('WP_SITEURL','http://example.com');. This way you can still go to your website and change stuff under example.com/wp-admin. Additionally you can add define('FORCE_SSL_ADMIN', true); and define( 'FS_METHOD', 'direct'); if you want. Just make sure these statements are put just above the that's all statement near the bottom of the file.
  16. sudo nano /etc/php.ini. Find upload_max_filesize and change to 100MB or something larger than the 2MB limit, if you want. also if you get errors with image uploading use sudo chmod 2775 /var/www/. Also go this mod: sudo nano /etc/yum/pluginconf.d/priorities.conf -> set enabled to 0 then sudo yum update.
  17. Plugins I use: Fast Velocity Minify (making cache work faster), Jetpack (real-time analytics), Loading bar (looks cool), Really Simple SSL (takes care of SSL settings), Title Remover (removes title automatically from pages), W3 total cache (also works with cache to speed up site), WP smush (makes images smaller), Yoast SEO (search engine optimization see https://goo.gl/uWU7gD)
  18. With all of that configured you should be good to go!

wordpress-amazon-ec2's People

Contributors

jschmidtnj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.