LAMP部署

https://lnmp.org/

2019年3月份在阿里云上开始LAMP的部署:

1、安装Apache

命令:yum install httpd //根据提示,输入Y安装即可成功安装
然后启动apache,并且设置系统让 Apache 开机自动启动。
命令:
service httpd start //启动Apache
chkconfig httpd on //设置开机自启

然后用命令:find / -name httpd.conf 找到配置文件,找到默认的网站根目录为:/var/www/html

关闭关闭Apache显示文件列表:修改httpd.conf中将“Options Indexes FollowSymLinks”的Indexes去除。

2、安装MariaDB

由于CentOS 7 将mysql全部都改成了mariadb。所以在CentOS 下yum安装mysql是没有用的。虽然还是有一大堆软件包叫做mysql。

yum install mariadb-server -y ##安装数据库服务软件

systemctl start mariadb ##开启数据库

mysqladmin -u root password '******' //设置服务器登陆密码,注意不要漏了分号

3、安装PHP

yum install php //由于安装php时候发现阿里云默认是php5,版本太低了。需要自己下载安装。

安装php7.1 安装php源
1. rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
2. rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
检查源是否安装成功
1.yum repolist enabled | grep "webtatic*"
安装php扩展源
1. yum -y install php71w php71w-fpm
2. yum -y install php71w-mbstring php71w-common php71w-gd php71w-mcrypt
3. yum -y install php71w-mysql php71w-xml php71w-cli php71w-devel
4. yum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache
验证php7.1.x和扩展是否安装成功 验证php是否安装成功
1. php -v
设置php-fpm并检测php-fpm的运行状态 启动php-fpm
1. service php-fpm start
检查启动是否成功
1. service php-fpm status

设置开机自启动
1. systemctl enable php-fpm.service

重启服务器:(一定要重启!

systemctl restart httpd

安装完毕


参考资料

阿里云服务器 ECS 部署lamp

阿里云服务器CentOS之mariadb数据库安装

阿里云安装PHP7.1

阿里云ECS的CentOS7下搭建FTP服务器

Centos7搭建FTP服务器



20190603 LNMP

Nginx设置404页面

error_page   404   /404.html;
location = /404.html {
root /home/***/***/**/***/assets/404;

}

注意在 nginx.conf文件中的server { } 里面


Nginx重启

nginx -s reload


添加MariaDB日志

general_log_file = /******/mariadb/var/mysql.log
general_log = 1


重新启动MariaDB

重新启动:service mysql restart
停止:service mysql stop
启动:service mysql start
状态:service mysql status


php镜像

http://mirrors.sohu.com/php/

安装教程|

Last update: 2022-08-19|Pageview:27
Research Blog: EC | EC_INFO | EC_WORK |


BypResearch