其他分享
首页 > 其他分享> > LAMP

LAMP

作者:互联网

一,安装Apache
yum install httpd -y,安装apache,版本为2.4.6,最新为2.4.9。
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak;
vim /etc/httpd/conf/httpd.conf (默认唯一)

端口改为8000,不能与Nginx重叠。

<VirtualHost *:8000>
DocumentRoot "/home/admin/tp5/public"
ServerName 007.liangyishipin.com:8000
<Directory "/home/admin/tp5">
Options FollowSymLinks Indexes
Require all granted
AllowOverride All
</Directory>
</VirtualHost>

systemctl start httpd,启动httpd.
systemctl enable httpd,设置httpd服务开机启动.
systemctl disable httpd.service 停止开机自启动
systemctl status httpd,查看服务状态.

二,安装mysql5.7
(0),列出所有被安装的rpm package
rpm -qa | grep mariadb
强制卸载,因为没有--nodeps
rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64(举例)
(1). 下载mysql的repo源
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
查看可以被安装的mysql列表(默认只有mysql57-community/x86_64允许安装,最稳定)
yum repolist all | grep mysql
(2). 安装mysql57-community-release-el7-11.noarch.rpm包
sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
(3). 安装mysql
sudo yum install mysql-server -y
(4)登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),
原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:
sudo chown -R openscanner:openscanner /var/lib/mysql
然后,重启服务:
service mysqld restart
(5),修改密码
mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('123456') where USER='root';
mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
mysql> \q
(5)解决Navicat 出错:1130-host . is not allowed to connect to this MySql server,MySQL

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; //赋予任何主机访问数据的权限
mysql>FLUSH PRIVILEGES; //修改生效

你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'dongshang2018' WITH GRANT OPTION;
FLUSH PRIVILEGES;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;

(6) mysql官方下载地址
https://dev.mysql.com/downloads/repo/yum/

三,安装PHP7.2
1,# yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2使用yum list命令查看可安装的包(Packege)。

3安装PHP5.6
yum install -y php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd
php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-bcmath php72w-dba php72w-enchant php72w-imap php72w-interbasephp72w-intl php72w-ldap
php72w-mcrypt php72w-odbc php72w-pdo_dblib php72w-pear php72w-pecl-apcu php72w-pecl-imagick
php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-pspell php72w-recode
php72w-snmp php72w-soap php72w-tidy php72w-xmlrpc php72w-pecl-igbinary php72w-intl
php72w-memcached php72w-pecl-mongodb
4连接mysql
rpm -ql php72w-mysqlnd

四,安装nginx1.12
1#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2使用下面命令安装nginx
yum install nginx -y
3启动Nginx
service nginx start
4 配置nginx支持php
cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
vim /etc/nginx/conf.d/default.conf (default.conf名字随便改,默认一个域名一个配置文件)(无需更改nginx.conf配置文件)


修改www.conf文件 vim /etc/php-fpm.d/www.conf (默认一个网站根目录对应一个配置文件,www.conf名字随便改)

service php-fpm start 启动php-fpm
service nginx restart 重启nginx

五,安装vsftpd
yum install -y vsftpd
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
vim /etc/vsftpd/vsftpd.conf
将anonymous_enable=YES 改为anonymous_enable=NO关闭匿名用户登入

修该网站根目录权限
chmod 777 /home/web chmod 777 /home/admin
关闭setenforce (临时关闭)
setenforce 0
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可
开放防火墙端口
firewall-cmd --zone=public --add-port=22/tcp --add-port=80/tcp --add-port=21/tcp --add-port=20/tcp --add-port=3306/tcp --add-port=443/tcp --add-port=8877/tcp --add-port=9988/tcp --permanent
重启防火墙
firewall-cmd --reload
查看进程
netstat -tulp

标签:httpd,--,nginx,LAMP,conf,mysql,php72w
来源: https://www.cnblogs.com/xiaojiashi/p/15973289.html