linux yum lamp,CentOS7 yum 安装LAMP

这篇博客详细介绍了如何在重新安装了CentOS7的VPS上,从更新系统到安装Apache、MariaDB和PHP,再到配置Apache支持PHP和设置服务开机自启动的整个过程。包括yum命令的使用、Apache配置文件的修改以及虚拟主机的设置等关键步骤。
摘要由CSDN通过智能技术生成

最近把vps系统重新安装了一下,更换了系统模版为CentOS7。命令和CentOS6有所不同。

1、更新系统

yum makecache fast

yum update

2、安装apache

yum install httpd

3、安装数据库mariadb

yum install mariadb mariadb-server mariadb-devel

4、安装php和常用库

php php-devel php-common php-cli php-mbstring php-gd php-bcmath php-pdo php-pear php-xml php-xmlrpc php-mysqlnd

5、启动httpd、mysqld

systemctl start httpd.service

systemctl start mariadb.service

6、设置开机自启动服务

systemctl enable httpd.service

systemctl enable mariadb.service

7、配置apache

vim /etc/httpd/conf/httpd.conf

1)添加php支持

找到:

DirectoryIndex index.html

改为:

DirectoryIndex index.html index.php

找到:

AddType application/x-gzip .gz .tgz

在其下面加上以下内容:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

2)添加伪静态

AllowOverride All

# Allow open access:

Require all granted

3)在文件末尾添加虚拟主机配置

DocumentRoot "/home/live-in.org"

ServerName www.live-in.org

ErrorLog logs/live-in.org-error_log

CustomLog logs/live-in.org-access_log common

DeflateCompressionLevel 5

AddOutputFilterByType DEFLATE text/html text/css text/javascript application/x-javascript

DocumentRoot "/var/www/html"

ServerName xxx.xxx.xxx.xxx

PS:xxx.xxx.xxx.xxx填服务器IP

4)调整prefork进程数

StartServers 2

MinSpareServers 2

MaxSpareServers 3

MaxClients 4

MaxRequestsPerChild 500

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值