CENTOS7 Installation Configuration Tutorial: http://www.111cn.net/sys/CentOS/63645.htm
First, configure the firewall, open 80 ports, 3306 ports
CentOS 7.0 uses firewall as a firewall by default, and this is iptables firewall instead.
Systemctl Stop Firewalld.service #停止firewall
Systemctl Disable Firewalld.service #禁止firewall开机启动
2. Install iptables Firewall
Yum Install iptables-services #安装
Vi/etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by System-config-firewall
# Manual Customization of this file is not recommended.
-A input-m state--state established,related-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
-A input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
Systemctl Restart Iptables.service #最后重启防火墙使配置生效
Systemctl Enable Iptables.service #设置防火墙开机启动
#SELINUXTYPE =targeted #注释掉
System Yun-wei Www.111cn.net warm reminder: qihang01 original Content © Copyright, reproduced please indicate the source and the original chain
Yum Install httpd #根据提示, enter y installation to install successfully
Systemctl Start Httpd.service #启动apache
Systemctl Stop Httpd.service #停止apache
Systemctl Restart Httpd.service #重启apache
Systemctl Enable Httpd.service #设置apache开机启动
When you open the server IP address in the client browser, the following interface appears, stating that the Apache installation was successful
System Yun-wei Www.111cn.net warm reminder: qihang01 original Content © Copyright, reproduced please indicate the source and the original chain
CentOS 7.0, the MySQL database has been replaced with MARIADB
Yum Install mariadb mariadb-server #询问是否要安装, enter Y to install automatically until the installation is complete
Systemctl Start Mariadb.service #启动MariaDB
Systemctl Stop Mariadb.service #停止MariaDB
Systemctl Restart Mariadb.service #重启MariaDB
Systemctl Enable Mariadb.service #设置开机启动
CP/USR/SHARE/MYSQL/MY-HUGE.CNF/ETC/MY.CNF #拷贝配置文件 (Note: If the/etc directory has a my.cnf under the default, direct coverage can be)
2. Set password for root account
Mysql_secure_installation
Carriage return, enter y according to the prompt
Enter 2 times password, return
Follow the prompts to enter Y
Last seen: the for using mysql!
MySQL password settings complete, restart MySQL:
Systemctl Restart Mariadb.service #重启MariaDB
Third, the installation of PHP
Yum Install PHP #根据提示输入Y直到安装完成
2, the installation of PHP components, so that PHP support MARIADB
Yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath Php-mhash
#这里选择以上安装包进行安装, enter Y return according to the prompts
Systemctl Restart Mariadb.service #重启MariaDB
Systemctl Restart Httpd.service #重启apache
First, Apache configuration
Vi/etc/httpd/conf/httpd.conf #编辑文件
Serversignature on #添加, show Apache version on error page, off not show
Options Indexes followsymlinks #修改为: Options Includes execcgi followsymlinks (allows the server to execute CGI and SSI, disable listing of directories)
#AddHandler cgi-script. CGI #修改为: AddHandler cgi-script. PL (CGI script that allows the extension. pl to run)
AllowOverride None #修改为: allowoverride All (Allow. htaccess)
Adddefaultcharset UTF-8 #修改为: Adddefaultcharset GB2312 (add GB2312 to default encoding)
#Options Indexes followsymlinks #修改为 Options followsymlinks (does not display the tree directory structure on the browser)
DirectoryIndex index.html #修改为: DirectoryIndex index.html index.htm default.html Default.htmindex.php (set default first file, add index.php)
Maxkeepaliverequests #添加MaxKeepAliveRequests 500 (Increased number of simultaneous connections)
Systemctl Restart Httpd.service #重启apache
Rm-f/etc/httpd/conf.d/welcome.conf/var/www/error/noindex.html #删除默认测试页
Second, PHP configuration
Date.timezone = PRC #把前面的分号去掉, change 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
#列出PHP可以禁用的函数, if some programs need to use this function, you can remove it and disable it.
expose_php = Off #禁止显示php版本的信息
Short_open_tag = on #支持php短标签
Open_basedir =.:/ tmp/#设置表示允许访问当前目录 (that is, the directory of PHP script files) and the/tmp/directory, you can prevent the PHP Trojan Cross station, if the installer has problems after the change (such as: The Dream Content Management System), you can log off this line, or directly write the directory of the program/data/ www.111cn.net/:/tmp/
Systemctl Restart Mariadb.service #重启MariaDB
Systemctl Restart Httpd.service #重启apache
Enter the server IP address in the client browser and see the relevant configuration information as shown in the following figure!
NOTE: The Apache default program directory is/var/www/html
Permission settings: Chown apache.apache-r/var/www/html