Friday, February 14, 2014

Satisfying the Web Stack for Web Programming. (The easy way.)

Everyone has always wondered about creating their own website for their great ideas they have. They have questions like, "Where do I find a good domain to host?" or "How do I learn how to code this stuff?"

Web hosting is available from many websites. You can do a simple web search for "web hosting" and determine what one has the best offering for you.

Today we will talk about hosting a site locally on your PC, securing it from nasty hackers on your network and the basics of coding some simple test web pages.

The first thing you will need to do is to download XAMPP. You can find the latest version from here: http://www.apachefriends.org/index.html

Select the version that best fits your OS needs.

Upon installing you will see the below notification telling you that anti-virus may interfere with the install. I usually never disable my anti-virus in order to install this product. It may vary depending on what you use though.


Once you click "Yes", it will warn you about Windows' UAC. Just go ahead and click "Ok".



Next up is selecting the items you need to check in order to fit your website needs. 



You don't need much to get started and activating more things than what you need only makes more work for you. So just select what you need. In order to get things up and running, the below items are the things you SHOULD have active.



Once the installation is complete and you run the application for the first time, you will see the below image. Notice that some of the items have no "Start" button available on them. This is because you didn't install these features.



Once you start the app, you will notice it states that it has an adjacent port # for the service. This means the service was able to attach to a communication port and run. If it failed to run, then it would not have a port #. Sometimes this happens when another service is using that port # and it cannot take over the port. 



If you are succesfully able to run the services, you can select "Admin" on "MySQL" and it will take you to: http://localhost/phpmyadmin/.



Once you login, you will be brought to the below screen:



Select the "users" tab" and you will see the below image. Lots of accounts here initially. 



Select "Edit Privileges" on "Root:localhost" and scroll down to where you see "change password"



Settings a password for Root is VERY important for securing myphpadmin. Resrticting IP ranges to access this internal site is also a good approach. Here are some more tips:
  1. Consider using HTTP Basic Auth in front of PHPMyAdmin
  2. Always restrict access to only your IP Address if you can (this can help cut down on a number of login attempts)
  3. PHPMyAdmin needs to be secured, and kept up to date
  4. don't have predictable file locations such as /PHPMyAdmin (this cuts down on the attempts from automated scanners)
  5. Make sure you use HTTPS
  6. PHPMyAdmin configuration can store credentials, these could be compromised
Now that you have considered some security settings and setup everything. Try to test your server out. Go here: http://localhost/xampp/splash.php

Select your language and you should see the below image:



Test your PHP and make sure it's working. Click on the left hand side "phpinfo()". If you clicked it and do not get any errors, then it's installed properly and working. You should get information about your php version and such.

Make sure to edit C:\xampp\phpMyAdmin\config.inc if you get the dreaded: #1045 - Access denied for user 'root'@'localhost' (using password: NO) error.

Now, whatever you create as far as a website goes if it be .CSSs or HTMLs, you can place them in the folder of: C:\xampp\htdocs

After you place all your files in this location, you can browse to: 127.0.0.1.

If you have an index.html file, you can browse to http://127.0.0.1/index.html

Otherwise it will default to: http://127.0.0.1/xampp and it will generate an error if you do not have this file.

Have fun!

Disclaimer: I am not responsible for any damage or any malfunctions that may occur during the process of installing this application and use.

No comments: