CentOS6.4 install and configure the LAMP server (Apache + PHP5 + MySQL)

Source: Internet
Author: User
Welcome to the Linux community forum and interact with 2 million technical staff. Go to configuration 1. Configure vietchttpdconfhttpd in Apache. conf # edit the file ServerTokensOS and change it to "ServerTokensProd" in row 44 (the name of the server operating system is not displayed when an error page is displayed). ServerSignatureOn is located in row 536.

Welcome to the Linux community forum and interact with 2 million technical staff> go to configuration 1. Configure vi/etc/httpd/conf/httpd in Apache. conf # edit the file ServerTokens OS in row 44 and change it to: ServerTokens Prod (the name of the server operating system is not displayed when an error page appears) ServerSignature On line 536

Welcome to the Linux community forum and interact with 2 million technicians>

Configuration

1. Apache configuration

Vi/etc/httpd/conf/httpd. conf # edit the file

ServerTokens OS is changed to ServerTokens Prod in row 44 (the server operating system name is not displayed when an error page appears)

ServerSignature On is changed to ServerSignature Off On Line 1 (Apache version is not displayed On the error page)

Modify Options Indexes FollowSymLinks to: Options shortdes ExecCGIFollowSymLinks in row 331 (allow the server to execute CGI and SSI and prohibit the list of directories)

# Modify AddHandler cgi-script. cgi to AddHandler cgi-script. cgi. pl in row 796 (the extension is allowed. Run the CGI script of pl)

AllowOverride None is changed to AllowOverride All (allowed) in row 338. Htaccess)

Adddefadefacharset UTF-8 in line 759 is changed to: adddefadefacharset GB2312 (add GB2312 as the default encoding)

Modify Options Indexes MultiViews FollowSymLinks to Options MultiViews FollowSymLinks in row 554 (tree directory structure is not displayed in the browser)

Modify DirectoryIndex index.html. var to DirectoryIndex index.html index.htmDefault.html Default.htm in row 402.

Index. php Default. php index.html. var (set the Default homepage file and add index. php)

Modify KeepAlive Off to KeepAlive On (allow procedural connection) In line 76)

Modify MaxKeepAliveRequests 100 in line 83 to: MaxKeepAliveRequests 1000 (Increase the number of simultaneous connections)

: Wq! # Save and exit

/Etc/init. d/httpd restart # restart

Rm-f/etc/httpd/conf. d/welcome. conf/var/www/error/noindex.html # Delete the default test page

Ii. php configuration

Vi/etc/php. ini # Edit

Date. timezone = PRC # Remove the semicolon in front of row 946 and change it to date. timezone = PRC.

Disable_functions = passthru, exec, system, chroot, scandir, chgrp, chown, shell_exec, proc_open, proc_get_status, ini_alter, ini_alter, ini_restore,

Dl, openlog, syslog, readlink, symlink, popepassthru, stream_socket_server, escapeshellcmd, dll, popen, disk_free_space,

Checkdnsrr, checkdnsrr, getservbyname, getservbyport, disk_total_space, posix_ctermid, posix_get_last_error,

Posix_getcwd, posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_getgrnam, posix_getgroups, posix_getlogin,

Signature, posix_getpgrp, posix_getpid, posix_getppid, posix_getpwnam, posix_getpwuid, identifier, posix_getsid, posix_getuid, identifier, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid,

Posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_strerror, posix_times, posix_ttyname, posix_uname

# List the functions that PHP can disable in Row 3. If some programs need this function, delete it and disable it.

Expose_php = Off # disable display of php version information in line 432

Magic_quotes_gpc = On # enable magic_quotes_gpc On Line 1 to prevent SQL Injection

Open_basedir =. :/tmp/# Set in row 380 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/data/www.osyunwei.com/:/tmp/

: Wq! # Save and exit

/Etc/init. d/mysqld restart # restart MySql

/Etc/init. d/httpd restart # restart Apche

Test

Cd/var/www/html

Vi index. php # enter the following content

  

Phpinfo ();

?>

: Wq! # Save and exit

Enter the Server IP address in the browser of the client. The configuration information shown in is displayed!

Note: The default program directory of apache is/var/www/html.

Permission settings: chown apache. apache-R/var/www/html

[1] [2]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.