Ali cloud server centos7.2 deploy LAMP gymnastics record

Full deployment process is as follows:
1, the server administrator (root) password settings, set at Ali cloud management interface
2, computer maintenance installation putty
3, putty landing cloud server
4, install the Apache
yum -y install httpd
start the service: systemctl start httpd.service
settings at startup: systemctl enable httpd.service
configuration:
vi edit files /etc/httpd/conf/httpd.conf #
Options Indexes FollowSymLinks # amended to: Options Includes ExecCGI FollowSymLinks (allowing the server to execute CGI and SSI, prohibit column a directory)
the Require All denied amended as granted
:! WQ save and exit #
5, set the firewall
systemctl start firewalld start the firewall
firewall under Centos7 has been changed by the iptables firewall, use the firewall-cmd command to open ports 80 and 443: the following is a direct open It can also be used for ip rich rules liberalized segment.
cmd = --zone public-Firewall-Port --add = 80 / TCP --permanent
Firewall-cmd = --zone public --add-Port = 3306 / TCP --permanent
cmd = --zone public-Firewall-Port = 22 is --add / TCP --permanent
Firewall-cmd = --zone public --add-Port = 443 / TCP --permanent
Firewall-cmd --reload
. 6, provided SELinux to permissive mode (off by default Ali cloud without modification)
editor vim / etc / sysconfig / selinux SELinux = enforcing amended as disabled closed SELinux, restart permanent.
7, install MariaDB database
CentOS 7.0 has been used instead of the MariaDB MySQL database.
Installation: yum -y install mariadb-server
promoter: Start systemctl mariadb.service
systemctl enable mariadb.service
configuration: cp /usr/share/mysql/my-huge.cnf /etc/my.cnf enough to cover the original configuration.
Set the database administrator password: mysql_secure_installation all the way y can, of course, the first y later to enter the password twice.
Increase user see later.
8, mounting PHP5
installation main PHP: yum -y install php
mounting assembly PHP the PHP support MariaDB
yum -y install php-mysql php- gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
restart: systemctl the restart mariadb.service
systemctl the restart httpd.service
configuration can also not arranged :()
VI /etc/php.ini
the date.timezone = a PRC # remove the semicolon in front, to a PRC = the date.timezone
that the disable_functions = passthru, Exec, PHP can be listed System ...... # disable the function if some programs need to use this function, you can delete, cancel the disabled.
expose_php = Off # suppress php version information
short_open_tag = ON # support php short tag
open_basedir =:. / tmp / # setting means that allow access to the current directory (ie the directory PHP script file where the sum) and / tmp / directory, you can prevent php Trojan cross station
9, test: (/ var / www / html / website root directory)
vi /var/www/html/index.php input <PHP phpinfo ();??>
: WQ save and exit.
Open http: // server ip If you can see the PHP configuration page, it PHP server properly.
So far, LAMP platform to build better.
10, if that database management is too much trouble, you can use yum install phpMyAdmin installation graphical management tool.
11, build new users, modify / etc / ssh / sshd_config, close ssh root, modification ssh port, such as: change 11022. Then set the appropriate firewall configuration allows access of ip.
12, mysql build a user, set the appropriate permissions, try not to directly access the database with the root.


Some experience:
1. win10 comes with scp, transfer files easily
cmd command can be entered directly upload files to the server centos, note the file path to an absolute path
such as: scp d: /123/test.txt [email protected]: / var / WWW / HTML /
scp -rd: / 123 [email protected]: / var / WWW / HTML /
-R & lt dirctory
NOTE: win7 putty after installation can pscp, usage with scp
under 2. centos file_put_contents () can not be the reason is not written to the file folder permissions
directly modify the destination folder / file
# chmod 777 folder or file name
such as: chmod 777 /var/www/html/yj/data.txt
3. CentOS case-sensitive, so the file The best unified name with lowercase letters.
4. systemctl restart mariadb.service # restart MariaDB
systemctl httpd.service restart # restart the Apache
5. Be sure to install php-mysql, otherwise the database can not be called.
PHP-MySQL install yum
6. MYSQL command
(1) Log: mysql -h host address -u user name -p User password
(2) Exit: exit (Enter).
(3) modify the password: mysqladmin -u username -p password old password new password
(4) increase the user: grant permission on the database * to username @ log on the host identified by "password."
Such as:. Grant the Create, the SELECT, INSERT, Update, the Delete on * * to newuser @ localhost identified by "password";
Grant create, select, insert, update, delete on * * to newuser @ "%" identified by "password";. # "%" represents any host
grant all privileges on * * to root @ '%' identified by "root". ; # all privileges means all rights

Modify permissions Method:
use MySQL;
Update User SET Host = '%' WHERE User = 'newuser';

7.cp cover installation does not prompt (preceding cp '\' must be)
\ -f /usr/share/mysql/my-huge.cnf CP /etc/my.cnf

Guess you like

Origin www.cnblogs.com/tywusy/p/12129375.html