查看: 19|回复: 0

[Centos] 阿里云Centos7安装LNMP+wordpress

[复制链接]

1

主题

0

回帖

0

积分

积极分子

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2009-5-24
发表于 2023-10-25 00:00:00 | 显示全部楼层 |阅读模式

1. 安装Nginx

?
1
2
3
4
5
6
7
8
9
10
11
12
#yum install nginx      #配置文件处于/etc/nginx
#systemctl start nginx   #启动nginx
#systemctl enable nginx.service  # 设置为开机启动
 
#systemctl status firewalld  #检查防火墙,如果为active (running),则
#vim /etc/firewalld/zones/public.xml   # 在zone
 
<zone>
<service name=”nginx”/>
<zone>
#systemctl reload firewalld

测试:http://114.215.172.90/   114.215.172.90为外网ip地址

2. 安装Mysql(not MariaDB)

?
1
2
3
4
5
6
7
#rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
#yum repolist enabled | grep “mysql.*-community.*”
#yum -y install mysql-community-server
 
#yum -y install mysql-community-server   #安装社区版
#systemctl start mysqld                  # 启动mysql
#mysql_secure_installation              # mysql安全安装,输入root密码,一路y

3. 安装PHP

?
1
2
3
4
5
6
#yum install php-fpm php-mysql
#systemctl start php-fpm        # 启动php-fpm
#systemctl enable php-fpm      # 设置开机启动
 
#mkdir /var/www
#chown -R apache:apache /var/www

修改Nginx的配置文件:在 /etc/nginx/conf.d 目录下新建 wordpress.conf

?
1
2
3
4
5
6
7
8
9
10
11
12
server {
listen 8000;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 
location ~ \.php$ {
root /usr/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
?
1
#systemctl reload nginx

在/usr/www 目录中创建 phpinfo.php

?
1
<?php echo phpinfo(); ?>

外部访问:http://114.215.172.90:8000/phpinfo.php

4. 安装wordpress

从https://cn.wordpress.org/下载 wordpress-4.4.2-zh_CN.tar.gz, 解压到/usr/www
创建wordpress数据库

?
1
2
#mysql -uroot -p
#create database wordpress

通过http://114.215.172.90:8000/wordpress访问,并安装提示进行安装,中间需要添加mysql用户名和密码,并制定wordpress相关的用户名和密码,然后创建成功。

http://114.215.172.90:8000/wordpress/ 访问既可,也可以点击页面中的登陆进行页面设置等相关管理工作。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部