centos7安装LNMP环境时遇到的一些问题总结

1. 安装mysql

提示没有可用软件包 mysql-server。 错误:无须任何处理
从官网下载安装mysql-server:

1
2
3
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

2. 配置nginx支持php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
//将配置文件改为备份文件

# cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
//将默认的配置文件作为配置文件

# vim /etc/nginx/nginx.conf

location / {
root html;
index index.php index.html index.htm; #增加index.php
}

location ~ \.php$ {
root /usr/share/nginx/html; #修改为nginx默认路径
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

3. 安装wordpress

把wordpress文件下载解压到/usr/share/nginx/html