Use Apache as the local virtual hosting to preview the Blog
October 12, 2009 at 22:08
<VirtualHost *:80>
ServerName localhost
DocumentRoot F:/site
</VirtualHost>
Follow suit, if I want to use http://ww2.auciou.com to browse and test my Blog, copy the 4 lines of code as above, then change the values of ServerName in Line 2, and DocumentRoot in Line 3. The codes after change is as below:
<VirtualHost *:80>
ServerName ww2.auciou.com
DocumentRoot F:/site/auciou
</VirtualHost>
Then restart Apache, as well you may create many virtual hostings at local.
Open the file of C:\WINDOWS\system32\drivers\etc\hosts, write a line as below:
127.0.0.1 ww2.auciou.com
Then you may use Apache as the local virtual hosting to preview your own Blog, as the photo below:
The simple and convenient installation of Apache and PHP, please view this article which was written by me http://www.auciou.com/peace/78. All of my present development environments, are based on this background of Apache and PHP, need not to reinstall Apache and PHP after reinstall the system.
Permalink | Comments (0) | Trackback (0)
Create the development environment of Apache
October 09, 2009 at 00:25
Take the article before, for instance, all the same, the system is Win XP, create the folder D:\server:
Apache extracts at D:\server\apache;
PHP 5 extracts at D:\server\php5.
All of the settings below, we will change the file D:\server\apache\conf\httpd.conf, please open this file by a text tool.
The approach of creating a virtual hosting: write the codes as below at any position in the httpd.conf file:
<VirtualHost *:80>
ServerName ww2.auciou.com
DocumentRoot F:/site/auciou
</VirtualHost>
Commentary: the third line DocumentRoot F:/site/auciou, is the path of my blog in the local harddisk. Then open this file C:\WINDOWS\system32\drivers\etc\hosts, write a line as below:
127.0.0.1 ww2.auciou.com
The virtual hosting have been set up, restart Apache, then you may use http://ww2.auciou.com to visit the local sites. To set for many virtual hostings, are the same steps. (In addition, if you use IIS for a few, you may use the Port 80 for Apache and PHP, IIS uses the Port 50 or others.)
At last, restart Apache.
Permalink | Comments (1) | Trackback (1)
Reinstall Apache and PHP for one step
October 08, 2009 at 06:41
The development environment of this article is Win XP. While the PHP runs with IIS, it is very slow. Run PHP with Apache, the speed will be faster for much. MiniApache (2.0.5.2) is a simplified Apache, it is just 308 K. As the introduction said, the functions that used frequently are not reduced.
After I installed and tested for many times, I've known well this installation of MiniApache. In order to avoid reinstalling Apache and PHP after reinstalling the system, please install them in the Disk D, for example, I install at D:\server. Create the development environmen of yourself first, the steps of installation are:
PHPIniDir D:/server/php5
LoadModule php5_module D:/server/php5/php5apache2.dll
AddType application/x-httpd-php .php
Explanation: the second line is "Load Module", if without the third line, PHP cannot run, it just can display the HTML page.
DirectoryIndex index.html this line is the default document of the directory, change to DirectoryIndex index.php index.html
Hereafer, after reinstall the system, just double click D:\server\apache\setup.cmd, choose 1, Enter, install, Apache and PHP will be installed for just one step.
Permalink | Comments (2) | Trackback (2)
The elements of program of preventing the spam and closing IP
October 04, 2009 at 06:11
The elements of program of preventing is as below, this program is written in the common module such as judge.php, this file is includeed by the other files with the include() function.
<?$te=30; //You could set this value for the time which just can post for one time in 30 seconds, if omit $te=30;, the default value is 60.
if (!$te) $te=60;
$t9=time();
if ($t9-$_COOKIE[te]<$te) $kx.="The time between you post for 2 times should be more than ".$te." seconds, please post ".$te." seconds later.";
if ($kx) {……} //Take error to the poster, and the program will not run.
?>
Then write Cookies in post.php, as below:
<?if (!$kx) setcookie("te",$t9,$t9+$te,"/");?>
The program of closing IP is below:
<?$ip=$_SERVER["REMOTE_ADDR"];
$i=…… //$i was the IP list which reed from the database, such as the value of $i is "125.33.125.255,133.134.99.1", many IPs are spaced out by comma, this value can be revised in the background of site. Because the configurations of background of site are different, this article will not explain the program which how to revise this value, please write the program by yourself. Because the program below uses the strpos() function, not uses the circle program to judge that whether the IP of user exists in the $i value, you may set for many IPs which you want to close, several hundred IPs will not affect the efficiency of program for much. While the user-side write the Cookies, the user's IP is closed completely, you may delete all the value of $i.
$j=$_COOKIE[pe];
$h="Your IP is closed.";
if ($j) $kx.=$h;
elseif (strpos($i,$ip)!==false){$kx.=$h;
if (!$j) setcookie("pe","50",time()+86400*9,"/");}
if ($kx) {……} //Take error to the poster, and the program will not run.
?>
Permalink | Comments (0) | Trackback (0)
Category:
Program | Internet | Computer
Blog Research | PHP | Philosophy
Archives:
January 2011 | January 2010
December 2009 | October 2009 | September 2009 | April 2009
December 2008 | November 2008
May 2007 | April 2007
August 2005 | July 2005 | June 2005
May 2005 | April 2005 | March 2005
February 2005 | January 2005
Recent articles:
My Go Daddy hosting is fast
Create a house with your spouse on the interest
Pending time which add a domain of hosting, was more than 36 hours
Diary: 2010-01-15
Many Linux hostings do not support the mod_expires module
Figured out, there is still a way
About the delicated IP of IXWebHosting
About the QUERY_STRING parameter of URL
About the ping value and speed of site
The relation between program and .htaccess file
Saved a delicated IP
Judge that does a long-range file exist in PHP
How to call the Confederation of Planets and the high evolving beings of alien/pray/make a wish
Use Apache as the local virtual hosting to preview the Blog
Create the development environment of Apache
Reinstall Apache and PHP for one step
The elements of program of preventing the spam and closing IP
How to close the visit log of ixwebhosting
Happy Wedding to a friend
Make an easy Audio/Video converter