阿里云服务器手动搭建WordPress【官方文档&注意事项】

这是官方文档

注意事项

  1. 先配LNMP,我的上一篇文章

  2. 到这里发现,没有基于ubuntu的教程,所以创建服务器时选择centos

  3. 在官方文档第四步"下载WordPress,并移动至网站根目录"中,首先它让cd /usr/share/nginx/html,如果没有这个路径,一定是LNMP没弄对,请回到上一篇重新做,不要自作聪明mkdir出来(我在说我自己 +_+)。

  4. 在官方文档第六步"修改Nginx配置文件"中,sudo vim /etc/nginx/nginx.conf,打开文件后发现没有server。所以我将文档上的图片(下图)抄了下来。location php那一部分应该眼熟。注意,图片中的第一行文字要注释掉,否则会出现本文第8条的现象。

    server {
    listen 80;
    listen [::]:80;
    server_name _;
    root /usr/share/nginx/html/wordpress;

    复制代码
     # Load configuration files for the default server block.
     include /etc/nginx/default.d/*.conf;
    
     location / {
     	index index.php index.html index.htm;
     }
    
     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;
     }
    
     error_page 404 /404.html;
     location = /404.html {
     }
    
     error_page 500 502 503 504 /50x.html;
     location = /50x.html {
     }

    }

  5. 这里有一个小技巧,sudo nginx -t 可以检查配置文件是否正确,如果有错能给出出哪行语法错误(比如它提示了我大括号不匹配,最后发现少打一个分号)。直到无误后会有一个successful。

  6. 如果出现以下欢迎界面(Welcome to nginx! If you see this page),即将成功。注释掉配置文件的一行内容
    就是下面这个# include /etc/nginx/conf.d/*.conf;

结果:

注册登录后:

相关推荐
酱学编程4 小时前
【从零到一实现一个 AI Agent 框架 · 第四篇】04. 任务规划:拆解复杂目标 -
服务器·网络·数据库·人工智能
艾莉丝努力练剑6 小时前
OpenCode AI 编程:Ubuntu 24.04 环境安装与使用指南
linux·服务器·网络·人工智能·tcp/ip·ubuntu
崇山峻岭之间6 小时前
Keil5输出hex转换为bin的设置
linux·运维·服务器
Tian_Hang7 小时前
Eclipse Ditto 的权限策略
java·服务器·前端·网络·ide·ubuntu·eclipse
着迷不白9 小时前
Linux 磁盘管理完全指南:分区、文件系统、挂载与 LVM 实战
linux·运维·服务器
山川而川-R9 小时前
LangChain
linux·运维·服务器
QH_ShareHub9 小时前
Linux 根目录结构详解
linux·运维·服务器
骑士雄师9 小时前
langchain:推荐切片策略
服务器·前端·langchain
千逐6810 小时前
Uniapp 鸿蒙实战之 AtomGit APP - 仓库详情与文件树浏览
服务器·microsoft·uni-app
liuyicenysabel10 小时前
多服务上线日记二:
服务器·笔记·学习