CentOS系统下yum安装lnmp+wordpress

本文档详细介绍了在CentOS系统中如何使用yum命令安装LNMP(Nginx, MariaDB, PHP-FPM)环境,并进一步配置WordPress。步骤包括安装数据库服务器、编辑Nginx配置、设置PHP服务、初始化WordPress数据库以及解决可能出现的服务未安装问题。" 17249731,1369950,C++ 中利用gnuplot进行数据可视化实践,"['C++编程', '数据可视化工具', 'gnuplot接口', '科学计算']
摘要由CSDN通过智能技术生成

本博客纯属本人编辑,如有雷同纯属巧合
一、安装mariadb、mariadb-server、nginx、php-fpm

yum install -y mariadb mariadb-server nginx php-fpm 

等待安装完成,启动服务
**

二、编辑nginx配置文件

**
首先要在/目录下创建/www目录

[root@localhost ~]# cat /etc/nginx/fastcgi_params 

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name; //添加这行
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
[root@localhost ~]# cat /etc/nginx/conf.d/default.conf 
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /www; //修改为/www
        index  index.html index.htm index.php; // 添加index.php
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ { //取消前面的#注释
        root           /www; //修改为/www
        fastcgi_pass   127.0.0.1:9000; //环回地址与本机地址交换使用测验,我这里是使用环回地址
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

三、编辑PHP服务文件

[root@localhost ~]# cat /etc/php-fpm.d/www.conf  | grep -n ^[a-zA-Z]
12:listen = 127.0.0.1:9000
24:listen.allowed_clients = 127.0.0.1
39:user = nginx
41:group = nginx
60:pm = dynamic
70:pm.max_children = 50
75:pm.start_servers = 5
80:pm.min_spare_servers = 5
85:pm.max_spare_servers = 35
156:slowlog = /var/log/php-fpm/www-slow.log
219:php_admin_value[error_log] = /var/log/php-fpm/www-error.log
220:php_admin_flag[log_errors] = on
224:php_value[session.save_handler] = files
225:php_value[session.save_path] = /var/lib/php/session

四、启动数据库

  1. 创建表wordpress,然后查看
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| wordpress          |
+--------------------+
4 rows in set (0.01 sec)
  1. 添加所有访问权限
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '000000';
Query OK, 0 rows affected (0.00 sec)

五、编辑网站文件内容,使其连接数据库
网页访问ip地址,进行注册登录

在这里插入图片描述

网页显示有服务未安装,自行安装即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值