Installation:
1、 Install Apache
Yum install httpd? According to the prompt, enter y to install successfully
/Etc / init.d/httpd start
Chkconfig httpd on is set to startup
/Etc / init.d/httpd restart
2、 Install MySQL
1. Install MySQL
Yum install MySQL MySQL server? Ask if you want to install it. Enter y to install it automatically until the installation is completed
/Etc / init.d/mysqld start
Chkconfig mysqld on is set to start
CP / usr / share / MySQL / my-medium.cnf / etc / my.cnf ? copy the configuration file (Note: if there is a my.cnf under the / etc directory by default, you can directly overwrite it)
2. Set password for root account
mysql_secure_installation
Enter, enter y as prompted
Enter password twice, enter
Enter y all the way according to the prompts
Finally: thanks for using MySQL!
After setting the MySQL password, restart MySQL:
/Etc / init.d/mysqld restart
/Etc / init.d/mysqld stop
/Etc / init.d/mysqld start
3、 Install PHP4
1. Install PHP4
yum install php
Follow the prompts to enter y until the installation is complete
2. Install PHP components
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
Select the above installation package to install
Enter y as prompted
/Etc / init.d/mysqld restart
/Etc / init.d/httpd restart
Configuration section
1、 Apache configuration
VI / etc / httpd / conf / httpd.conf edit file
In line 44, the servertokens OS is modified to: servertokens prod (the name of the server's operating system is not displayed when an error page occurs)
Serversignature on is modified to: serversignature off (APACHE version is not displayed in the error page) in line 536
In line 331, options indexes followsymlinks is modified to: options includes execcgi followsymlinks
#Addhandler CGI script. CGI is modified to: addhandler CGI script. CGI. Pl (CGI script with extension. PL is allowed to run)
Allowoverride none in line 338 is modified to: allowoverride all (allow. Htaccess)
Add defaultcharset UTF-8 is modified to: add defaultcharset GB2312 (add GB2312 as the default encoding) in line 759
Change options indexes Multiviews followsymlinks to options Multiviews followsymlinks on line 554 (do not show tree structure on browser)
In line 402, modify directoryindex.html index.html.var to: directoryindex.html index.htm default.html default.htm
Index.php default.php index.html.var (set the default homepage file and add index. PHP)
Change keepalive off in line 76 to: keepalive on
In line 83, MaxKeepAliveRequests 100 is modified to: MaxKeepAliveRequests 1000 (increase the number of simultaneous connections)
: WQ! Save exit
/Etc / init.d/httpd restart
RM - F / etc / httpd / conf.d/welcome.conf / var / www / error / noindex.html ? delete the default test page
2、 PHP configuration
VI / etc / php.ini
Date. Timezone = PRC ? in line 946, remove the previous semicolon and change it to date. Timezone = PRC
disable_functions =
Show? PHP = off? Disable PHP version information on line 432
Magic ﹐ quotes ﹐ GPC = on ﹐ open magic ﹐ quotes ﹐ GPC on line 745 to prevent SQL injection
Short ﹐ open ﹐ tag = on ﹐ support PHP short tag in 229 lines
: WQ! Save exit
/Etc / init.d/mysqld restart
/Etc / init.d/httpd restart