CentOS 7.0 contact with the user is relatively small, today saw the webmaster wrote an article about the installation of CENTOS7 in the lamp server tutorial, the following I put the article a little collation to everyone to learn to exchange, I hope examples can bring you help Oh.
CENTOS7 Installation Configuration Tutorial: http://www.111cn.net/sys/CentOS/63645.htm
First, configure the firewall, open 80 port, 3306 port
CentOS 7.0 defaults to using firewall as the firewall, where the iptables firewall is changed. 1. Close Firewall:systemctl Stop firewalld.service #停止firewallsystemctl disable firewalld.service # Disable firewall boot 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.*FILTER:INP UT Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-m State--state established,related-j accept-a input-p icmp -j ACCEPT-A INPUT -i lo -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-prohibitedcommit:wq! # Save exit Systemctl Restart iptables.service #最后重启防火墙使配置生效systemctl enable iptables.service #设置防火墙开机启动二, Close selinuxvi/etc/selinux/config#selinux=enforcing #注释掉 #selinuxtype=targeted #注释掉SELINUX =disabled #增加: wq! # Save Exit Setenforce 0 #使配置立即生效
Installation article: Install Apache system operation and maintenance www.111cn.net Warm reminder: qihang01 original Content © Copyright, reproduced please specify the source and the original chain yum install httpd #根据提示, Enter Y installation to successfully install SYSTEMCTL start httpd.service #启动apachesystemctl stop httpd.service #停止apachesystemctl restart httpd.service #重启apachesystemctl Enable httpd.service #设置apache开机启动在客户端浏览器中打开服务器IP地址, the following interface appears, Description Apache Installation Successful system operation www.111cn.net warm reminder: qihang01 original Content © Copyright, reproduced please specify the source and the original chain two, installation Mariadbcentos 7.0, You have replaced MySQL database 1 with mariadb, installed Mariadbyum install mariadb mariadb-server #询问是否要安装, enter Y to install automatically until the installation is complete Systemctl start mariadb.service #启动MariaDBsystemctl stop mariadb.service #停止MariaDBsystemctl restart Mariadb.service #重启MariaDBsystemctl enable mariadb.service #设置开机启动cp/usr/share/mysql/my-huge.cnf/etc/my.cnf # Copy the configuration file (Note: if the/etc directory has a default MY.CNF, directly overwrite can) 2, set the password for the root account mysql_secure_installation enter, according to the prompt input y input 2 times password, Enter Y as prompted, and last appear: Thanks for using mysql! MySQL Password Setup Complete, restart Mysql:systemctl restart mariadb.service #重启MariaDB三, install PHP1, install Phpyum installation php #Follow the prompts to enter Y until installation is complete 2, install PHP components, make PHP support Mariadbyum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc Php-mbstring Php-bcmath php-mhash# Here to select the above installation package for installation, according to the prompt input y return systemctl restart mariadb.service # Restart Mariadbsystemctl Restart httpd.service #重启apache
Configuration Article One, Apache configuration vi/etc/httpd/conf/httpd.conf #编辑文件ServerSignature on #添加, the version of Apache is displayed in the error page, off is not display options Indexes followsymlinks #修改为: Options includes execcgi followsymlinks (Allow server to execute CGI and SSI, disallow listing of directories) #AddHandler Cgi-script. CGI #修改为: AddHandler cgi-script. cgi. PL (allows CGI scripts with extension. pl to run) allowoverride None #修改为: allowoverride All (Allow. htaccess) Adddefaultcharset UTF-8 #修改为: Adddefaultcharset GB2312 (add GB2312 as default encoding) #Options Indexes followsymlinks #修改为 Options followsymlinks (does not display the tree structure on the browser) directoryindex index.html #修改为: DirectoryIndex index.html index.htm default.html Default.htmindex.php (set default home file, add index.php) maxkeepaliverequests # Add maxkeepaliverequests 500 (increase number of simultaneous connections):wq! #保存退出systemctl restart httpd.service #重启apacherm-F/etc/httpd/ conf.d/welcome.conf/var/www/error/noindex.html #删除默认测试页二, PHP configuration vi/etc/php.ini #编辑date. TimeZone = PRC #把前面的分号去掉, change to Date.timezone = Prcdisable_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# lists the functions that PHP can disable, and if some programs need to use this function, they can be removed and deactivated. expose_php = off #禁止显示php版本的信息short_open_tag = on #支持php短标签open_basedir =.:/ tmp/ #设置表示允许访问当前目录 (that is, the PHP script files in the directory) and/tmp/directory, you can prevent the PHP Trojan cross-site, if you change the installation program after the problem (such as: Dream Content Management System), you can log off this line, or directly write the program directory/data/ www.111cn.net/:/tmp/:wq! #保存退出systemctl Restart Mariadb.service #重启MariaDBsystemctl Restart httpd.service #重启apache
Test ArticleCd/var/www/htmlvi index.php #输入下面内容 <?phpphpinfo ();? >:wq! #保存退出在客户端浏览器输入服务器IP地址, you can see the relevant configuration information as shown! NOTE: The Apache default program directory is the/var/www/html permission setting: Chown apache.apache-r/var/www/html
CentOS 7.0 System installation Configuration Lamp Server (APACHE+PHP+MARIADB)