In this second part of a three-part tutorial covering phpAdsNew, you will learn more about the features of the "Publishers" and "Advertisers" module, as well as a convenient way to integrate phpAdsNew with multiple websites, and more.
It is common knowledge that a Web entrepreneur is always looking for ways to leverage his existing infrastructure. Take Google, for example: it started with a search engine, then, it launched Froggle and more recently, it added email to its portfolio in the form of Gmail. You get the picture!
If you are a part of this group - and, more importantly, have many "popular" websites, it does not make sense to have multiple local instances (one for each website) of phpAdsNew on your server. In such a scenario, you are better off installing phpAdsNew at a custom URL - http://ads.mysite.com.
As usual, I’ll give you step-by-step instructions on how to go about this transformation. For starters, you’ll need to unzip the phpAdsNew source code archive at a convenient location under the root folder of your Web server, as I’ve done below:
$ cd /www/htdocs/
$ tar -xzvf /tmp/phpAdsNew-2.0.4-pr2.tar.gz
$ mv phpAdsNew-2.0.4-pr2 phpads
Next, you need to configure your Web server. I’ll assume (as I did in the first part) that you are using Apache. As you may be aware, this Web server supports the concept of Virtual Hosts; for the uninitiated, this feature allows a single Apache instance to host several websites, simultaneously.
Coming back to phpAdsNew, consider the following scenario: you own a Web site accessible at http://www.mysite.com. Next, you would like to add a couple more - a new website (say http://www.mynewsite.com), and the phpAdsNew application, set up so that its administration module can be viewed at http://ads.mysite.com.
This is not a problem. Just fire up your favorite text editor and load the "httpd.conf" file, which controls configuration of your Apache Web server. Add the following line of code:
NameVirtualHost *:80
Note that this may already be present in your file - just uncomment the instructions by removing the "#" character at the beginning of the line. Next, insert these VirtualHost directives to configure the different websites that I’ve listed above:
Note that you may have to configure the DNS server to map IP addresses to the appropriate URLs. If this sounds like Greek and Latin to you, it's time to seek the assistance of the server administrator of your Web server.
Now, let me give you a quick run-down of the "VirtualHost" directives that I’ve listed above. For obvious reasons, the IP addresses are different for each block because the Web server has been configured to serve more than one IP address. Another important point to note is the path specified in the "DocumentRoot" directive in each block. The more discerning amongst you will notice that this points to the root folder of the corresponding website.
Restart the server and load the following URL: http://ads.mysite.com. If all goes well, you should see the familiar administration module of phpAdsNew.
Note that first-time installers will see the default installation wizard in the browser. Just follow the steps outlined in the first part of this tutorial and voila - phpAdsNew should be up and running in no time!