如何在linux中搭建lamp架构?

如何在linux中搭建lamp架构?,第1张

按步骤安装和配置,首先安装Linux系统,可选择redhat/centos/ubuntu/suse等发行版,然后安装和配置apache服务器软件、MySQL数据库、PHP软件(通常还应安装诸如zendframework/thinkphp/yii等框架),盯迅具体步骤使用链蚂 *** 作命令安装配置,从而搭建web应用开发或生产环境凯唤此,当然也可通过诸如集成安装包进行一体化自动安装和配置

yum -y install epel-release

yum -y install yum-utils

yum update

yum -y install httpd

systemctl enable httpd

systemctl start httpd

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd --reload

# 隐藏版扒厅本号

vim /etc/httpd/conf.d/secure.conf

TraceEnable off

ServerSignature Off

ServerTokens Prod

# 配置vhost

vim /etc/httpd/conf.d/vhosts.conf

DocumentRoot "/var/和茄www/html"

ServerName example.com

ServerAlias www.example.com

ErrorLog "logs/example.com-error_log"

CustomLog "logs/example.com-access_log" combined

yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

yum install certbot python2-certbot-apache

certbot --apache

systemctl restart httpd

# 安装MySQL8 YUM源

rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

yum install mysql-community-server

systemctl enable mysqld

systemctl start mysqld

# 查看自动生成的MySQL密春棚隐码

grep "password" /var/log/mysqld.log

# 登录MySQL后修改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'

# 刷新MySQL权限表

FLUSH PRIVILEGES

yum-config-manager --disable remi-php54

yum-config-manager --enable remi-php73

yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-opcache php-redis php-soap

# 隐藏php版本号

vim /etc/php.ini

expose_php = off

系统参数设置

# 文件打开数设置

ulimit -n 65535

vim /etc/security/limits.d/nofile.conf

* soft nofile 65535

* hard nofile 65535

# 内核网络优化

vim /etc/sysctl.conf

# 启用timewait 快速回收

net.ipv4.tcp_tw_recycle = 1


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12547088.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存