阿里云服务器手动搭建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;

结果:

注册登录后:

相关推荐
网硕互联的小客服6 小时前
Linux服务器磁盘应该如何合理分区?
linux·运维·服务器
lisanmengmeng7 小时前
nacos nrpe 监控机及被监控机部署
服务器·nacos·nagios·nrpe
2301_808414388 小时前
Linux中动静态库的理解
linux·运维·服务器
可涵不会debug10 小时前
第一次学 LangGraph:用一个快递案例搞懂 State、Node、Edge 和 compile
服务器·数据库·mysql
Web极客码11 小时前
抹平首包开销:我用 Claude 调优 Nginx 的 Brotli 与 Gzip 动态压缩,平衡 CPU 与网络吞吐
服务器·agent 工作流·agent 图
云杂项12 小时前
tmux指南:安装、配置与高效使用(Ubuntu上)
linux·服务器·ubuntu
泡海椒13 小时前
趋势分析报表:jquick-pdf折线图PDF生成实战
java·大数据·运维·服务器·前端·pdf
qq_3945620013 小时前
【在Linux上升级nginx】
linux·服务器·nginx
丸子君君13 小时前
【以麒麟服务器时间为准,定时请求时间同步】
运维·服务器·单片机
Tairitsu_H13 小时前
[Linux系统] 基础IO核心 | 系统接口 | 文件描述符 | 重定向
linux·服务器·文件操作