CentOS 7, LAMP
Brief introduction:
Lamp refers to the first letter of the Linux (operating system), Apachehttp Server, MySQL (sometimes also referred to as MARIADB, database software) and PHP (sometimes referred to as Perl or Python), which is generally used to build a Web application platform.
CentOS Release version 7.0, the new version brings many features, in addition to the kernel update to 3.10, support for Linux containers, Open VMware Tools and 3D images can be ready to use, to Systemd, Firewalld and GRUB2, and the default file system for the XF s and so on, can be said to be a more significant upgrade. The author tries to use CENTOS7 to build lamp server platform, record as follows.
1. Enable Apache2
Centos7 The HTTPD service is installed by default, but it is not started. If you need a new installation, you can yum install-y httpd
Start service: Systemctl start Httpd.service
Set boot auto start: Systemctl enable Httpd.service
The HTTP server has been started for a simple configuration
Vi/etc/httpd/conf/httpd.conf #编辑文件
Serversignature on #添加, the Apache version is displayed on the error page, off is not displayed
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.htm index.php (set default home file, add index.php)
Maxkeepaliverequests #添加MaxKeepAliveRequests 500 (increase the number of simultaneous connections)
: wq! #保存退出
Systemctl Restart Httpd.service #重启apache
Rm-f/etc/httpd/conf.d/welcome.conf/var/www/error/noindex.html #删除默认测试页
2. Setting up a firewall
The firewall under CENTOS7 has been changed from iptables to firewall, using the Firewall-cmd command to open ports 80 and 443:
Firewall-cmd–permanent–zone=public–add-service=http
Firewall-cmd–permanent–zone=public–add-service=https
Firewall-cmd–reload
Set the SELinux to permissive mode command line under Setenforce 0 to take effect immediately and reboot to fail.
Edit Vim/etc/sysconfig/selinux selinux=enforcing modified to disabled turn off SELinux and restart for permanent effect.
The author IP is 192.168.1.108, test the server can open, browser http://192.168.1.108 return to see the Welcome page, indicating that the server is working properly.
3. Installing the MARIADB Database
CentOS 7.0, already using MARIADB to replace the MySQL database, because you understand, MySQL was acquired by Oracle after the prospect of worry, so MySQL brother Mariadb out, continue to open source business.
Installation: yum-y Install Mariadb-server mariadb
Start: Systemctl start Mariadb.service
Systemctl Enable Mariadb.service
Configuration: cp/usr/share/mysql/my-huge.cnf/etc/my.cnf Overwrite the original configuration is good.
Set database administrator password: mysql_secure_installation All the way y can, of course, the first time after Y to enter the password two times.
4. Install PHP
Install PHP Main program: yum-y install PHP
Install PHP components to enable PHP support MariaDB
Yum-y Install PHP-GD php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp Php-soap Curl Curl-devel
Restart: systemctl Restart Httpd.service
Configuration: Vi/etc/php.ini
Date.timezone = PRC #把前面的分号去掉, changed to Date.timezone = PRC
Disable_functions = Passthru,exec,system ...
#列出PHP可以禁用的函数, if some programs need to use this function, you can delete, cancel disable.
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, you can log off this line, or directly write the program directory/data/www.osyunwei.com/:/tmp/
Test: vi/var/www/html/index.php
Input <?php phpinfo ();?>
Wq Save exit.
Open http://192.168.1.108 If you can see the PHP configuration Information page, the PHP server is OK.
At this point, the lamp platform is built!
This article is from the "11253644" blog, please be sure to keep this source http://11263644.blog.51cto.com/11253644/1765987
CentOS 7, lamp