Thursday, 2 February 2017

How to post form data to google sheet


Static sites are ever so useful. Not everything needs CMS like  WordPress or some other active website framework. I use Middleman to create static sites, but there are several other tools available.

If one hosts one’s static site at a server where PHP is available, then collecting information entered into a form is not difficult. But what if one hosts at Amazon S3, where no scripting language is available?

There exists commercial services for handling form data, such as JotForm. But maybe you don’t want to spend $8/month (personal) or $20/month (commercial) to collect form data.

Although documentation exist on posting form data to google sheet as a database like the post by Martin Hawksey where he showed  how to   use Google Sheets as a Database - INSERT with Apps Script using POST/GET methods (with ajax example) using a combination of JavaScript in the browser and a Google App Script to send form data to a spreadsheet (Google Sheets) the steps were not well spelled  out .

The Form


Create a file named index.html and copy this into it:

<html>
<head>
  <!-- META DATA -->
 <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="Demo form ">
    <meta name="author" content="wwww.gigzweb.blogspot.com">
    <title>demo page</title>
   <link rel="stylesheet" href="css/style.css">
    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css"  type="text/css">
 <!-- Custom Fonts -->
 <link href='http://fonts.googleapis.com/css?family=Asap:400,700' rel='stylesheet' type='text/css'>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
 
</head>
<body>
<div background-color:gray;>
 <div class="col-md-8">
 <h3>Contact Form</h3>
<form name="form1" method="post" id="defaultgsheets" action= "">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control input-lg" name="name" id="name" placeholder="Enter name" required="required" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="email" class="form-control input-lg" name="email" id="email" placeholder="Enter email" required="required" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="text" class="form-control input-lg" name="subject" id="subject" placeholder="Subject" required="required" />
</div>
</div>
</div>
 <div class="row">
 <div class="col-md-12">
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="4" cols="25" required="required"
placeholder="Message" style="height: 190px;"></textarea>
</div>      
<button type="submit" class="btn btn-skin btn-block" name="submit" id="submit">Submit</button>
</div>
</div>
</form>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  <!-- Custom Theme JavaScript -->
  <script src='google-sheet.js'></script>
</div>
</div>
 
</div>
</body>
</html>



The Javascript


Create a file named google-sheet.js in the same directory and copy this into it:


// Variable to hold request
var request;

// Bind to the submit event of our form
$("#defaultgsheets").submit(function(event){

    // Abort any pending request
    if (request) {
        request.abort();
    }
    // setup some local variables
    var $form = $(this);

    // Let's select and cache all the fields
    var $inputs = $form.find("input, select, button, textarea");

    // Serialize the data in the form
    var serializedData = $form.serialize();

    // Let's disable the inputs for the duration of the Ajax request.
    // Note: we disable elements AFTER the form data has been serialized.
    // Disabled form elements will not be serialized.
    $inputs.prop("disabled", true);

    // Fire off the request to /form.php
    request = $.ajax({
        url: "SCRIPT URL GOES HERE",
        type: "post",
        data: serializedData
    });

    // Callback handler that will be called on success
    request.done(function (response, textStatus, jqXHR){
        // Log a message to the console
        console.log("Hooray, it worked!");
        console.log(response);
        console.log(textStatus);
        console.log(jqXHR);
    });

    // Callback handler that will be called on failure
    request.fail(function (jqXHR, textStatus, errorThrown){
        // Log the error to the console
        console.error(
            "The following error occurred: "+
            textStatus, errorThrown
        );
    });

    // Callback handler that will be called regardless
    // if the request failed or succeeded
    request.always(function () {
        // Reenable the inputs
        $inputs.prop("disabled", false);
    });

    // Prevent default posting of form
    event.preventDefault();
});




The Sheet


Navigate to drive.google.com and click on NEW > Google Sheets to create a new Sheet. Give it a name, perhaps “Form Google Sheets”. Put the following names into the first row of the first five columns:

Timestamp  name  email subject message



The Script


Click on Tools > Script Editor…, which should open a new window and a dialog called ‘Google Apps Script’. Click on Create script for > Custom Functions in Sheets. This will create one script called 'Code.gs’ containing functions such as SAY_HELLO.

Click on 'Untitled Project’ at the top and give this project a name: 'Form Script’.

Highlight all of this script (we are going to replace it) and paste in the following:


//  1. Enter sheet name where data is to be written below
        var SHEET_NAME = "Sheet1";


var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service

// If you don't want to expose either GET or POST methods you can comment out the appropriate function
function doGet(e){
  return handleResponse(e);
}

function doPost(e){
  return handleResponse(e);
}

function handleResponse(e) {
  // shortly after my original solution Google announced the LockService[1]
  // this prevents concurrent access overwritting data
  // [1] http://googleappsdeveloper.blogspot.co.uk/2011/10/concurrency-and-google-apps-script.html
  // we want a public lock, one that locks for all invocations
  var lock = LockService.getPublicLock();
  lock.waitLock(30000);  // wait 30 seconds before conceding defeat.

  try {
    // next set where we write the data - you could write to multiple/alternate destinations
    var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
    var sheet = doc.getSheetByName(SHEET_NAME);

    // we'll assume header is in row 1 but you can override with header_row in GET/POST data
    var headRow = e.parameter.header_row || 1;
    var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
    var nextRow = sheet.getLastRow()+1; // get next row
    var row = [];
    // loop through the header columns
    for (i in headers){
      if (headers[i] == "Timestamp"){ // special case if you include a 'Timestamp' column
        row.push(new Date());
      } else { // else use header name to get data
        row.push(e.parameter[headers[i]]);
      }
    }
    // more efficient to set values as [][] array than individually
    sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
    // return json success results
    return ContentService
          .createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
          .setMimeType(ContentService.MimeType.JSON);
  } catch(e){
    // if error return this
    return ContentService
          .createTextOutput(JSON.stringify({"result":"error", "error": e}))
          .setMimeType(ContentService.MimeType.JSON);
  } finally { //release lock
    lock.releaseLock();
  }
}

function setup() {
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    SCRIPT_PROP.setProperty("key", doc.getId());
}
p>Click on the Save icon. Set the dropdown in the nav bar to 'setup’ and click on the right-pointing triangle to its left to run this function. It should show 'Running function setup’ and then put up a dialog 'Authorization Required’. Click on Continue. In the next dialog 'Request for permission - Formscript would like to’ click on Accept.
In the menus click on File > Manage Versions… We must save a version of the script for it to be called. In the box labeled 'Describe what has changed’ type 'Initial version’ and click on 'Save New Version’, then on 'OK’.

Back to the menus: click on Resources > Current roject’s triggers. In this dialog click on 'No triggers set up. Click here to add one now’. In the dropdowns select 'doPost’, 'From spreadsheet’, and 'On form submit’, then click on 'Save’.

Back to the menus: click on Publish > Deploy as web app… For 'Who has access to the app:’ select 'Anyone, even anonymous’. Leave 'Execute the app as:’ set to 'Me’ and Project Version to '1’. Click the 'Deploy’ button.

A dialog should appear announcing 'This project is now deployed as a web app’. Copy the Current web app URL from the dialog; it should look something like:

https://script.google.com/macros/s/AKfycbw6RTOxn5OT_BIw9Nl_3KoFSXEQEbiKSZCLyombb1YqkGfRKUSz/exec

Click OK.

Now go back to google-sheet.js and replace 'SCRIPT URL GOES HERE’ with the URL copied from the dialog.

Display or refresh the index.html web page. Enter data into the four fields and click on the 'Send’ button. Within a few seconds that data should appear in your Google sheet. If your browser is Google Chrome, right-click in the web page and click on Inspect Element > Console. It should show:

Hooray, it worked!
- Object
success
- Object

Well done! You can now modify this form and drop it into any web page to collect–at no cost–responses from those who visit your page. With a little research and effort you may be able to get Google Apps to email every time someone submits your form.



Saturday, 17 December 2016

What to expect from gigzweb in 2017


Hi everyone, as the year comes to an end in less than three weeks we at Gigzweb are preparing a wonderful package for you guys out there.

What to expect in 2017





We will introduce PHP programming using the Codeigniter framework.

          Although there are loads of other PHP frameworks out there like CakePHP, Zend framework and symphony. But we will be working with Codeigniter because of its lightweight structure and a properly documented manual. 
Process flow of Codeigniter framework


We will critically analyze the MVC structure of programming.


          MVC stands for Model, View ,Controllers. It is not a programming language rather it is a    style of programming more like an architectural pattern.


I will be having a  series of tutorials on how to build a simple user registration system from scratch to finish using the Codeigniter framework.


           By next  I will be starting my series on PHP programming, in this series of tutorials I will touch every aspect of Codeigniter to produce a simple user registration  system

flow chart of the URS we will be building 

The new year holds a lot in stock for us, and with your support, we will surely make the best out of 2017.

In other for us to serve you better please subscribe to our blog to get instant updates delivered straight to your Email for free. All you have to do is to scroll down and subscribe by entering your email address.

Friday, 18 November 2016

Virtual Hosting with the new WampServer 3.0.6

Have you ever wondered how you can work on your local server without having to type localhost/example in your browser? well if you have or not it is very possible and even easier with the new WampServer 3.0.6 through what is known as Virtual Host (Vhost).

Most web developers are familiar with this term , but let me make some clarification for you newbies out there, virtual host refers to the practice of running more than one website such as  gigzweb.com and gigzweb2.com on the same physical machine. virtual Host can be either IP-Based or Named -Based . For IP- Based virtual host you have different IP address for every website while the Named- Based virtual host just en-tells that you have multiple names running on each IP address.





The benefits of enabling virtual hosting in a local environment are enormous;

1.It helps you testing the behaviour of each site you develop

2.It comes in very handy when your working with PHP frame works like codeigniter ,CakePHP, Zend frame work and the rest which requires a base URL configuration, since  almost all the PHP frame works out there use the MVC architecture of programming it becomes very necessary.

3 Most importantly it enables you to work on different projects at the same i.e having multiple projects in your WWW directory.

4.virtual host generally makes URLs cleaner - localhost/gigzweb.com  vs  gigzweb.com

With the release of WampServer 3.0.6 the problems which were involved in enabling virtual  host in Apache was handled. Previous  versions of WampServer required editing and modification of the Apache config files to enable  virtual host,I personally had to uninstall my Wamp 2.5 three times while trying to enable Virtual Host because of the changes I made to my config files  , previous versions   also required writing rules for IP address in your windows host files which you shouldn't try unless you know what  your doing.

follow these steps to configure a virtual Host in WampServer 3.0.6;


1.Download and install the  latest version of WampServer which at the time  I was writing this post was 3.0.6. from  the WampServer official page .



  NOTE Wamp 3.0.6 was developed using visual studio 2015, so to be able to run the programme you need to download  and install visual studio redistributable 2015 from the official Microsoft site if you have any problem while installing the package  try running a complete  windows update.

2.launch the application .check to see if the green icon


is showing in your task bar, if not know that all the services  are not running.if you get this error " msvcr110.dll missing" message while launching  the application  try uninstalling  and reinstalling your vc_redist 2015 and make sure your windows is up to date.



3. visit "localhost " in your browser and you should see the WampServer default homepage


4.clik on  add "a virtual host" a the bottom of the page.

6.  In the next page add the name of your virtual host you wish to create, for this tutorial I will be creating "www.mynewsite.com" as my virtual Host name .Next add the directory to the folder which contains your site files this should be a sub directory under your C:\wamp\www directory which is your main http directory. the directory should have a forward slash instead of a backward slash example;   "C:/wamp/www/www.mymynewsite.com

Note:the virtual Host name does no have o be the same with the site directory.

5.  click on "start creation of virtual host".

6. Restart your WampServer to effect the changes by right clicking on your wampserver icon and selecting tools,under tools select restart DNS.

7.  Finally go to www.mynewsite.com on your browser to view your newly created virtual host.



Hey guys, I hope this post was helpful, do drop your comments and I will get back to you.Bye for now till my next post.
.

Saturday, 12 November 2016

HOW TO CONFIGURE WAMPSERVER FOR WORDPRESS LOCAL DEVELOPMENT

If your a BLOGGER  or your planning to be become ONE or your a WEB DEVELOPER and you like trying out  new functionalities and design then your in the right place on how  to step up a WordPress  site in a local environment !!!.
My local sites run much faster, plus testing products on my local machine is much safer than testing on a "live site" – not to mention much cheaper without the cost of web hosting.
Setting up a local server environment for WordPress isn’t difficult and will save you time in the long run since you won’t have to install and uninstall a fresh copy of WordPress online each time you test or develop something for WordPress.
There are many options for Windows. I’ve previously looked at how to set up a localhost using WAMP. In this tutorial I’ll walk you through how to set up WampServer for local WordPress development which will including , creating a MySQL database, and installing WordPress. I’ve included optional steps for setting up Multisite.
Before I proceed with this tutorial I will like to  briefly answer these very important  questions ;what is WordPress? what is WampServer? and why you need a local development server. so lets get started.

what is WordPress?


WordPress is a  content management system (CMS) which  is free and open-source and is based on PHP and MySQL. WordPress needs  installed on a web server to function , which either is part of an Internet hosting service or is a network host itself; the first case may be on a service like WordPress.com, . WordPress is reportedly the easiest and most popular blogging system in use on the Web  supporting more than 60 million websites.

for example, and the second case is a computer running the software package WordPress.org. An example of the second case is a local computer configured to act as its own web server hosting WordPress for single-user testing or learning purposes. Features of WP include a plugin architecture and a template system. WordPress is currently being used by more than 26.4% of the top 10 million websites as of April 2016.




What is WampServer?


WampServer is a popular Windows web development environment that allows you to create web applications with Apache2, PHP and a MySQL database

.
WordPress isn’t a stand-alone application and needs server software to run. WampServer provides the necessary server environment so you can install and run WordPress on your local machine rather than on the internet.

Installing WampServer

Head over to the WampServer site and download the latest version of the software if you have WampServer already installed on your device you may want to skip this step. WampServer is an open source project and is free to use.
The WampServer site offers two versions of the software – 32 BITS or 64 BITS. Click on the version you prefer.
A warning message will display. Click on “download directly,” and you’ll be taken to the SourceForge website. The download will automatically start in 5 seconds.
The WampServer executable file is small at just 41.5MB, compared to XAMPP, which is 125MB.
You may receive warnings about installing the software on your computer. As you would when installing any software on Windows, use your best judgment, though it’s best to ignore the warnings if you want the installation to continue.
The WampServer setup wizard will guide you through the installation.


The next window will ask you to agree with the software’s terms and conditions. Check “I accept the agreement” and click “Next.”
Next, select where you would like to install the software and click “Next.” The default is c:\wamp, which I’m going to use for this tutorial I will like you to do same.


In the next window, you can choose to create shortcuts so you can quickly and easily access WampServer on your computer. I’m not going to create any for this tutorial.
Once installed, you may be prompted to choose your default browser. In my case, I chose Google Chrome.
You’ll then be prompted again to specify the SMTP server and the email address to be used by PHP. These settings aren’t all that important, so just leave the defaults and click “Next.”

Fill in your details or just leave the defaults.
Installation is now complete! Click “Finish” and the software will launch.

This green icon indicates that you have successfully installed WampServer

If you click “Finish” and the software doesn’t launch and you run into any errors, like the one below


it might be that you don’t have the Microsoft Visual C++ libraries installed on your computer and Apache and PHP won’t run without them.

For Windows 32BIT: Install the Visual C++ 2010 SP1 Redistributable Package x86 : VC10 SP1 vcredist_x86.exe
For Windows 64BIT: Install the Visual C++ 2010 SP1 Redistributable Package x64 : VC10 SP1 vcredist_x64.exe

Depending on your local machine, you may have to install one or both of these files. If WampServer still doesn’t work, trying installing Visual C++ Redistributable for Visual Studio 2012 Update 4.
If you continue to have any issues, check out the WampServer forums.
If any security warnings pop up, such as firewall warnings, be sure to allow access otherwise the software won’t work.
If you click “Finish” and the software does launch, a WampServer icon will appear in the systems tray.
The color of the WampServer icon allows you to quickly determine the status of your servers.

1. If the icon is red, the server isn’t running and is offline. You may need to restart WampServer or check out the WampServer forums for more help.

2. If it is orange, the server is partially running, i.e. Apache may be running and the MySQL service is offline. Click on the WampServer icon and check the service status next to Apache and MySQL to see if they are running. You may need to restart WampServer, and if it still doesn’t work, check out the WampServer forums.

3. If the icon is green, it means the server is running and you should be able to access localhost from your browser.



To test it, go to “http://localhost” in your browser you should see the WampServer default page if every thing went well with your installation.



Setting Up Your MySQL Database

Before we install and run our WordPress installation , we need a database.
Click on the WampServer icon in your system tray and then click on phpMyAdmin.



A page will open in your browser

Click on “Databases” near the top-left and you’ll be prompted to create a new database. I’ve called mine “WP”.
When you’ve entered a name, click “Create” and close the window.

Download and Install WordPress

Download the latest version of WordPress from WordPress .org as the time of writing this post the latest version was 4.6.1.
In order to get WordPress working with WampServer you need to unzip WordPress to the right folder. Extract WordPress to the C:/wamp/www/ folder.


You can rename the WordPress folder whatever you like. I’m going to keep it as “wordpress.”

Next, open your WordPress folder, find the wp-config-sample.php file and rename it wp-config.php. Open the file and scroll down until you see the following lines:


Update your wp-config.php file with your database details.
These lines of code define the login details for your database. Replace “database_name_here” with the name of your database, which in my case is “WP.”
Replace “username_here” with “root” and leave “password_here” blank.
Save the file and close it.
Now we can get on with installing WordPress.
Open your browser and go to http://localhost/wordpress/
You should see the welcome screen for the famous five minute WordPress installation process.
Famous five minute install


Enter your details and click “Install WordPress.”
Your WordPress installation is now complete!

Setting up WordPress Multisite(optional)

Setting up Multisite on a localhost provides a quick and easy way to test/develop themes and plugins away from a live site.
Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:




Click on the WampServer icon in your system tray and ensure your Apache and MySQL servers are running.
Login to your localhost site in your browser and under “Tools” you will now have a new option,



Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.
Enter a name for your network and your email address, then click “Install.”
WordPress will prompt you to edit your wp-config.php and .htaccess files.
Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:

Edit your wp-config file to get Multisite up and running.
Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.
Your .htaccess file should look like this:


Edit your .htaccess file to complete your Multisite installation.
Multisite should now be enabled and working on your WordPress site!

Your Multisite network should now be up and running!


In conclusion
WampServer offers a relatively easy way to run a local server environment on your Windows machine, allowing you to test and develop locally rather than online.
Running WordPress locally will save you a lot of time since you won’t have to install and uninstall a fresh copy of WordPress each time you test themes and plugins with your web host.
While WampServer is free and open source software, it’s easy to run into trouble setting it up on Windows. While putting this tutorial together I ran into a bunch of issues trying to get Apache working. XAMPP is relatively easier to setup and I would recommend that as a more reliable alternative.
Overall, setting up a server environment is relatively painless and something I would recommend to any WordPress developer or hacker.

How to host your website using Wamp server

So you want host your own website, well you found the right post. If you have a spare Windows machine and some time, I will show you how to host your own website using WAMP server from your home or office. In this post I will show you the steps I took to configure WAMP.
 to start my web server and host my own website for testing and personal projects.
You may have one or several reasons why you would want to host your own website, perhaps you want to:

  • host a small personal blog.
  • host a portfolio site.
  • host your resume.
  • test a web application.
  • or just simply learn how to setup your own web server, of course.


The steps required are as followes

INSTALL WAMPSERVER 2.5


I have a separate post on how to do this if you need help with this step. Simply download wamp server from WampServer and take the defaults. Once it is installed you will notice the green light on the wamp icon on your system tray.

If the icon is red or orange, you have a conflict with another application. In my case, most of the time I encounter this issue is if IIS is running on the machine. You can check what service is using port 80 if you want to confirm this. Go to  Apache –> Service –> Test Port 80 and see which service is using port 80. If IIS is using the port, you will want to disable the following service: IIS Admin Service and World Wide Web Publishing Service.

You can check out my post on trouble shooting  the orange status light in WAMP Server
 for additional help with the orange status light.

Set WAMP Server to run on automatic


Configure the ‘Startup Type’ under Window services to automatic for both wampapache and wampmysql services.Now you will want to make wampmanager.exe start when Windows starts. So in case you re-start your server, or it re-starts itself due to Windows updates, power surges, or other unpredictable cause, your are covered.
Check out my post on Configuring WAMP  Server on Windows for WordPress local developmentfor further details on how to do this step.

Configure Windows Firewall to allow wampmanager, port 80 and 443


Port 80 and 443 must be allow for both TCP and UDP packets. To do this, create 2 inbound rules for TPC and UDP on Windows Firewall for port 80 and 443.
Also, allow wampmanager.exe found in the wamp installation folder, in my case that is C:\wamp.

Set the MySQL root password


This is a very important step. I suggest making a strong password with upper and lower case letters and numbers, throw in a couples of symbols too. There are a few ways to do this, one is by going to the MySQL console and typing the appropriate commands, another way is via the GUI (graphical user interface) using SQL Buddy or PHPMyAdmin. Go to my post on how-to-set-the-mysql-root-password-in-localhost-using-wamp how to set the Root password for MySQL
 for steps by steps instructions on how to do this.

Configure PHPMyAdmin


Configure phpMyAdmin to require a password. Open the config.inc.php file found in C:\wamp\apps\phpmyadmin[version#] and edit the following:

On the following lines..

$cfg['Servers'][$i]['auth_type'] = 'config';

Change ‘config’ to ‘http’.

$cfg['Servers'][$i]['user'] = 'root';

Delete user root and just leave the quotation marks empty, like so = ‘ ‘;

$cfg['Servers'][$i]['AllowNoPassword'] = true;

Change true to false.

Create a Log Out URL by adding the following line..

$cfg['Servers'][$i]['LogoutURL'] = 'http://your-external-ip-address/';

Now, if you have a static IP, you should be ok entering it here. But in case you do not, like most of us, then you will want to enter the domain you plan on using for your website (recommended).

Save your file and go to C:\localhost\phpmyadmin – You should be prompted for a user name and password now.

Configure Apache


Now we need to make Apache listen to port 80 on our host machine. For this, open your httpd.conf file found under C:\wamp\bin\apache\apache[version#]\conf and edit the following lines:

Listen 0.0.0.0:80
ServerName localhost:80

Change it to..

Listen youripaddress:80
ServerName youipaddress

where youipaddress is equal to the local ip address of your web server.

Find <Directory “c:/wamp/www/”> and enter:

Order Allow,Deny
Allow from all

right before </Directory>

Save the file.

Configure PHPMyAdmin Alias file


This will allow us to access PHPMyAdmin from the web. Open phpmyadmin.conf found in C:\wamp\alias and edit the following line:

Require local

and replace it with..

Require all granted

Save the file. You should now be able to access the site via http://youripaddress and PHPMyAdmin via http://youripaddress/phpmyadmin

Enhancing Security


Please note that WAMP Server is commonly used for local development, and not as a hosting platform for production as it is inherently un-secure. However, you can take some measures to secure it like the ones I am going to suggest here.

Here are a few things to check for: Open your httpd-default.conf file found under C:\wamp\bin\apache\apache[version#]\conf\extra and make sure you set the following parameters..

ServerTokens Prod

This directive configures what WAMP returns as the Server HTTP response, setting it to prod returns the least info.

ServerSignature Off

This will stop Apache from broadcasting the server signature, which includes server version and virtual host name and other possibly sensitive information.

TimeOut 60

This will help prevent DoS attacks. It should be 60 by default but check just in case.

Re-start all services if you haven’t been doing so by clicking on ‘Restart all services‘.

You are almost done, next step is to remove the files in the www folder. You can delete them or move them to another folder outside "www"
You can now place your website files in here.

For additional security, I suggest placing an index file in the root and any sub directory of your website.

Adding an htaccess file with an unauthorized directory browsing rule would be ideal. You can drop this line in the .htaccess file:

#to disable directory browsing

Options All -Indexes

and place it in your root (www) and that should take care of things. To create an .htacces file in Windows check out this post from Stackoverflow
Also, check out Perishablepress htaccess tricks page for some cool things you can do with htaccess files to greatly enhance your websites security.
I wrote this tutorial based on my own experience with WAMP and what I have learned from others on the internet. I am not a security expert so if you have any suggestions on how to further secure WAMP or you have some best practices please feel free to let me know in the comments below.

Forward web traffic to your web server’s IP.


If you are reading this, I am going to assume you are somewhat familiar with port forwarding . But if you need help, just type ‘port forwarding’ in Google and you will get many sites that will show you how to forward a port. Basically, you want to forward any web traffic on port 80 to your machines local IP address. If you plan on using ssl, you may also want to forward port 443. On my router, it looks something like this:


Put WAMP Server online


The last step is to put WAMP server online.

You did it!  Now sit back, enjoy some tea and watch your web server do what its meant to do, serve your web pages to the world!

Hopefully this will help you in your current and future web projects. If you have any questions about this setup please leave me a comment below and I will be happy to help.

Thank you for stopping by.