栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

centos7搭建LNMP部署wordpress

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

centos7搭建LNMP部署wordpress

**WordPress是一款常用的搭建个人博客网站软件,该软件使用PHP语言开发。

  • 搭建nginx

    默认情况下centos7.6没有nginx的源,需要配置Nginx官网提供Gentos的源地址。

  • 配置nginx源
[root@hl-web lnmp-wordpress]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

[root@hl-web ~]# yum search nginx

  • 安装nginx
[root@hl-web ~]#  yum install -y pcre-devel openssl-devel #安装nginx依赖包
[root@hl-web ~]# yum install -y nginx
  • 实现PHP联动

    • 配置nginx的/etc/nginx/conf.d/default.conf文件,
      server {
          listen       80;
          server_name  192.168.0.116;
      
          #access_log  /var/log/nginx/host.access.log  main;
      
          location / {
              root   /usr/share/nginx/html/wordpress;
              index index.html index.htm index.php;
          }
      
          
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   /usr/share/nginx/html;
          }
      
          location ~ .php$ {
               root           /usr/share/nginx/html/wordpress;
               fastcgi_pass   127.0.0.1:9000;
               fastcgi_index  index.php;
               fastcgi_param  script_FILENAME  $document_root$fastcgi_script_name;
               include        fastcgi_params;
             }
          
      }
      
      
    • 或者有的是配置nginx的/etc/nginx/nginx.conf文件
      http {
          log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                            '$status $body_bytes_sent "$http_referer" '
                            '"$http_user_agent" "$http_x_forwarded_for"';
      
          access_log  /var/log/nginx/access.log  main;
      
          sendfile            on;
          tcp_nopush          on;
          tcp_nodelay         on;
          keepalive_timeout   65;
          types_hash_max_size 4096;
      
          include             /etc/nginx/mime.types;
          default_type        application/octet-stream;
      
          # Load modular configuration files from the /etc/nginx/conf.d directory.
          # See http://nginx.org/en/docs/ngx_core_module.html#include
          # for more information.
      
          # Load modular configuration files from the /etc/nginx/conf.d directory.
          # See http://nginx.org/en/docs/ngx_core_module.html#include
          # for more information.
          include /etc/nginx/conf.d
      define('DB_NAME', 'wordpress');
      
      
      define('DB_USER', 'root');
      
      
      define('DB_PASSWORD', 'password');
      
      
      define('DB_HOST', 'localhost');
      
      
      define('DB_CHARSET', 'utf8');
      
      
      define('DB_COLLATE', '');
      
    • 验证wordpress,浏览器输入http://192.168.0.116
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/388863.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号