赞
踩
Ubuntu22.04安装Wordpress,加LNMP配置(非宝塔安装)_ubuntu nginx搭建wordpress-CSDN博客
- # 安装依赖软件
- apt update && apt install wget curl nano libgd3 -y
-
- # 安装nginx,ubuntu22.04默认版本就是1.18
- apt install nginx -y
-
-
- #检查nginx服务
- systemctl status nginx
-
-
-
-
- # 设置php安装源安装php
- add-apt-repository ppa:ondrej/php
- #输入之后会出现Press [ENTER] to continue or Ctrl-c to cancel.按回车就好
-
- apt install php8.2 php8.2-fpm -y
-
- #这里我们用nginx,删掉apache2(没有安装可忽略)
- apt autoremove apache2 --purge -y
-
- #检查php版本
- php -v
- #出现如下结果
- #PHP 8.2.1 (cli) (built: Jan 6 2023 15:18:43) (NTS)
-
-
-
- #安装mysql8.0
-
- apt install mysql-server-8.0 php8.2-mysql -y
-
-
-
- #注意:将'passwd'更改为你自己想要的密码
- mysql -u root
- #测试连接使用:mysql -u root -ppasswd
-
- #这条是8.0标准改root用户的密码
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passwd';
-
- #这条是将root用户的访问权限变成任意位置
- UPDATE mysql.user SET user.Host='%' where user.User='root';
-
- #创建wordpress的数据库
- create database ziuwpdb1988;
-
- #创建woredpress数据库的用户,并赋权
- create user 'ziuwpdb1988user'@'localhost' identified by 'ziuwpdb1988userqqq...@';
-
- GRANT ALL PRIVILEGES ON `ziuwpdb1988`.* TO `ziuwpdb1988user`@`localhost`;
-
- flush privileges;
-
- #然后退出mysql
- exit
-
-
-
-
-
- #此处为官方推荐安装方式---暂时没用
- apt install lsb-release
-
- curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
-
- echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
-
- apt-get update && apt-get install redis -y
- #检查版本
- redis-cli -v
- #redis-cli 7.0.7
-
-
-
- #你们也可用xftp或者finalshell直接从本地上传
- wget https://cn.wordpress.org/latest-zh_CN.tar.gz
-
- #解压
- tar -zxvf latest-zh_CN.tar.gz
-
- #挪到web专用目录去
- mv wordpress/ /var/www/html/
-
- #调整权限
- chmod -R 755 /var/www/html/
- chown -R www-data:www-data /var/www/html/
-
-
-
-
-
- rm -rf /etc/nginx/sites-enabled/default
-
- vim /etc/nginx/sites-enabled/wp
- #会用vim也可,此处用nano演示
- #将下面的代码复制粘贴进去
-
- server {
- listen 80 ;
- listen [::]:80 ;
-
- # listen 443 ssl http2;
- # listen [::]:443 ssl http2;
- root /var/www/html/wordpress;
-
- index index.php index.html index.htm index.nginx-debian.html;
-
- server_name localhost;
-
- location / {
- try_files $uri $uri/ =404;
- }
-
- location ~ \.php$ {
- include snippets/fastcgi-php.conf;
- fastcgi_pass unix:/run/php/php-fpm.sock;
- }
-
- location ~ /\.ht {
- deny all;
- }
-
- }
-
- #如上就是nginx最简配置代码
- systemctl restart nginx
- ss -tunpl| grep nginx
使用自己的ip地址访问
http://192.168.1.5/wp-admin/setup-config.php
现在就开始!
http://192.168.1.5/wp-admin/setup-config.php?step=1&language=zh_CN
输入数据库名,用户名,密码,点击提交
运行安装程序
设置站点标题,用户名,密码,电子邮箱,点击安装wordpress
设置完成后登录即可(使用前面自己设置的用户名和密码登录即可)
http://192.168.1.5/wp-login.php
root
yOee8jGqD4pgwD1Gq8
2023 年 24 个商业网站必备的 WordPress 插件 - 知乎
推荐插件:
WooCommerce
ALL IN ONE SEO
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。