Centos6.4 LAMP Server Installation Configuration
LAMP refers to the first letter of the Linux (operating system), ApacheHTTP server, MySQL (sometimes MariaDB, database software), and PHP (sometimes Perl or Python, it is generally used to build a web application platform.
In LNMP, N indicates Nginx.
Configure the firewall and enable port 80 (web) and Port 3306 (mysql)
Vi/etc/sysconfig/iptables
-A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT
# Restart the firewall after wq is saved
# Service iptables restart
Disable selinux
Vi/etc/selinux/config
SELINUX = disabled
Save and exit
Setenforce 0 # Make the configuration take effect immediately
1. install Apache
Yum install httpd-y
Service httpd start # start the http service
Chkconfig httpd on # Auto Start Service
Enter the local ip address in the browser to check that apache is installed successfully.
Configure apache
Vi/etc/httpd/conf/httpd. conf
ServerTokens Prod does not display the server operating system when an error page appears
ServerSignature Off does not display apache version on the error page
Options Indexes ExecCGI FollowSymLinks allows the server to execute cgi and ssl, and does not allow the server to list directories.
AddHandler cgi-script. cgi. pl allows cgi scripts with the extension. pl to run
AllowOverride All allows. htaccess
Adddefacharcharset GB2312 modify GB2312 as the default encoding
Options MultiViews FollowSymLinks does not display the tree directory structure in the browser
DirectoryIndex index.html index.htm Default.html Default.htm
KeepAlive ON allows programs to come online
MaxKeepAliveRequests 1000 modifies the number of simultaneous connections
Restart http after saving
Service httpd restart
Ii. Install mysql
Yum install mysql-server-y
Servcie mysqld start
Chkconfig mysqld on
Mysql_secure_installation # mysql security settings, passwords, and so on
3. install php
Yum install php-y
Install the php component to make php support mysql
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-y
Restart mysql and httpd services
Service mysqld restart
Service httpd restart
Configure php
Vi/etc/php. ini:
Date. timezone = PRC
Disable_functions = passthru, exec, system, chroot, scandir, chgrp, chown, shell_exec, proc_open, proc_get_status, ini_alter, ini_alter, disconnect, dl, openlog, syslog, readlink, symlink, release, delimiter, delimiter, dll, popen, disk_free_space, checkdnsrr, checkdnsrr, getservbyname, getservbyport, delimiter, posix_getgrnam, posix_getgroups, posix_getlogin, delimiter, delimiter, posix_getpid, delimiter, delimiter, posix_getpwuid, delimiter, posix_getsid, posix_getuid, delimiter, posix_kill, posix_mkfifo, delimiter, posix_setsid, posix_setuid, posix_strerror, posix_times, posix_ttyname, posix_uname
# List functions that can be disabled by PHP. If some programs need this function, they can be deleted and disabled.
Expose_php = Off # disable php version display
Short_open_tag = ON # php short labels supported
Open_basedir =. :/tmp/# set to allow access to the current directory (that is, the directory where the PHP script file is located) And/tmp/directory, which can prevent php trojans from being cross-site, if there is a problem with the installation program after the change (for example, zhimeng Content Management System), you can log out of this line or directly write the program directory.
Save and exit, restart mysql, http service
Service httpd restart
Service mysqld restart
Test
Cd/var/www/html
Vi index. php
<?
Phpinfo ();
?>
Save and exit
Enter an IP address in the browser to view
Note: The default program directory of apache is/var/www/html.
Permission settings: chown apache. apache-R/var/www/html