In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "CentOS6.4 how to install and configure LAMP server", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "CentOS6.4 how to install and configure LAMP server" bar!
Preparation:
1. Configure the firewall to open port 80 and port 3306
Vi / etc/sysconfig/iptables
-an input-m state-- state new-m tcp-p tcp-- dport 80-j accept # allows port 80 to pass through the firewall
-an input-m state-- state new-m tcp-p tcp-- dport 3306-j accept # allow port 3306 to pass through the firewall
Note: many netizens add these two rules to the last line of the firewall configuration, causing the firewall to fail to start
The correct thing should be added to the bottom of the default port 22 rule
As follows:
# # after being added, the firewall rules are as follows # #
# firewall configuration written by system-config-firewall
# manual customization of this file is not recommended.
* filter
: input accept [0:0]
: forward accept [0:0]
: output accept [0:0]
-an input-m state-- state established,related-j accept
-an input-p icmp-j accept
-an input-I lo-j accept
-an input-m state-- state new-m tcp-p tcp-- dport 22-j accept
-an input-m state-- state new-m tcp-p tcp-- dport 80-j accept
-an input-m state-- state new-m tcp-p tcp-- dport 3306-j accept
-an input-j reject--reject-with icmp-host-prohibited
-a forward-j reject--reject-with icmp-host-prohibited
Commit
#
/ etc/init.d/iptables restart # finally restart the firewall for the configuration to take effect
2. Close selinux
Vi / etc/selinux/config
# selinux=enforcing # comment out
# selinuxtype=targeted # comment out
Selinux=disabled # increased
: wq # Save, close
Shutdown-r now # restart the system
Installation:
First, install apache
Yum install httpd # according to the prompts, enter y to install successfully
/ etc/init.d/httpd start # launch apache
Note: an error will be prompted after apache starts:
Starting httpd:httpd: could not reliably determine the server's fully qualif domain name, using:: 1 for servername
Solution:
Vi / etc/httpd/conf/httpd.conf # editing
Find # servername
Change it to servername # and set it to your own domain name. If you don't have a domain name, you can set it to localhost.
: wq! # Save exit
Chkconfig httpd on # is set to boot
/ etc/init.d/httpd restart # restart apache
Second, install mysql
1. Install mysql
Yum install mysql mysql-server # asks if you want to install, enter y to install automatically until the installation is complete
/ etc/init.d/mysqld start # launch mysql
Chkconfig mysqld on # is set to boot
Cp / usr/share/mysql/my-medium.cnf / etc/my.cnf # copy the configuration file (Note: if there is a my.cnf by default under the / etc directory, you can overwrite it directly)
2. Set the password for the root account
Mysql_secure_installation
Enter and enter y as prompted
Enter the password twice and enter
Enter y all the way according to the prompt
Last appeared: thanks for using mysql!
After setting the mysql password, restart mysql:
/ etc/init.d/mysqld restart # restart
/ etc/init.d/mysqld stop # stop
/ etc/init.d/mysqld start # launch
Third, install php5
1. Install php5
Yum install php
Follow the prompts to enter y until the installation is complete
2. Install php components to make php5 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
Select the above installation package to install here
Enter y enter according to the prompt
/ etc/init.d/mysqld restart # restart mysql
/ etc/init.d/httpd restart # restart apche
Configuration section
I. apache configuration
Vi / etc/httpd/conf/httpd.conf # edit file
Servertokens os is modified to: servertokens prod at line 44 (the name of the server operating system is not displayed when an error page appears)
Serversignature on is modified to: serversignature off at line 536 (the version of apache is not displayed in the error page)
Options indexes followsymlinks is modified to: options includes execcgi followsymlinks at line 331 (allows the server to execute cgi and ssi, and forbids listing of directories)
# addhandler cgi-script .cgi is modified at line 796 to: addhandler cgi-script .cgi .pl (allows cgi scripts with .pl extension to run)
Allowoverride none is modified at line 338 to: allowoverride all (allow .htaccess)
Adddefaultcharset utf-8 is changed to: adddefaultcharset gb2312 at line 759 (adding gb2312 as the default encoding)
Options indexes multiviews followsymlinks is changed to options multiviews followsymlinks at line 554 (does not display the tree directory structure on the browser)
Directoryindex index.html index.html.var is modified to: directoryindex index.html index.htm default.html default.htm at line 402.
Index.php default.php index.html.var (set the default home file, add index.php)
Keepalive off was modified at line 76 to: keepalive on (programmatic online allowed)
At line 83, maxkeepaliverequests 1000 is changed to: maxkeepaliverequests 1000 (increase the number of simultaneous connections)
: wq! # Save 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 # editing
Date.timezone = prc # remove the previous semicolon on line 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 Posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, 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 can be disabled by php on line 386. If some programs need to use this function, you can delete it and undisable it.
Expose_php = off # suppresses the display of php version information on line 432
Magic_quotes_gpc = on # Open magic_quotes_gpc at line 745 to prevent sql injection
Short_open_tag = on # supports php short tags on line 229th
Open_basedir =.: / tmp/ # setting at line 380 allows access to the current directory (that is, the directory where the php script files are located) and the / tmp/ directory, which can prevent the php Trojan from crossing the site. if there is a problem with the installer after the change (for example, the weaving dream content management system), you can log out of this line or write directly to the program's directory / data/www.osyunwei.com/:/tmp/
: wq! # Save exit
/ etc/init.d/mysqld restart # restart mysql
/ etc/init.d/httpd restart # restart apche
Test piece
Cd / var/www/html
Vi index.php # enter the following
: wq! # Save exit
Enter the server ip address in the client browser, and you can see the relevant configuration information shown in the following figure!
Note: the default program directory for apache is / var/www/html
Permission setting: chown apache.apache-r / var/www/html
Thank you for your reading, the above is the content of "how to install and configure LAMP server for CentOS6.4". After the study of this article, I believe you have a deeper understanding of how to install and configure LAMP server for CentOS6.4. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.