哈喽大家好,我是koten,本篇文章详细给大家介绍如果用LNPM架构部署WordPress,话不多说,我们直接开始。
第一步:配置Nginx虚拟主机站点,域名为blog.koten.com
1. [root@Web01 /]# vim /etc/nginx/conf.d/wordpress.conf 2. server { 3. listen 80; 4. server_name blog.koten.com; 5. root /code/wordpress; 6. index index.php index.html index.htm; 7. 8. location ~\.php$ { 9. root /code/wordpress; 10. fastcgi_pass 127.0.0.1:9000; 11. fastcgi_index index.php; 12. fastcgi_param SCRIPT_FILENAME $document_root$fast 13. cgi_script_name; 14. include fastcgi_params; 15. } 16. <ginx/conf.d/wordpress.conf" 14L, 314C written 17. [root@Web01 /]# nginx -t 18. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 19. nginx: configuration file /etc/nginx/nginx.conf test is successful
第二步:重启nginx服务
[root@Web01 /]# systemctl restart nginx
第三步:获取wordpress产品,解压并部署wordpress
1. [root@Web01 /]# mkdir code 2. [root@Web01 /]# cd code/ 3. [root@Web01 code]# wget https://cn.wordpress.org/latest-zh_CN.tar.gz 4. --2023-04-04 15:59:27-- https://cn.wordpress.org/latest-zh_CN.tar.gz 5. Resolving cn.wordpress.org (cn.wordpress.org)... 198.143.164.252 6. Connecting to cn.wordpress.org (cn.wordpress.org)|198.143.164.252|:443... connected. 7. HTTP request sent, awaiting response... 200 OK 8. Length: 23763585 (23M) [application/octet-stream] 9. Saving to: ‘latest-zh_CN.tar.gz’ 10. 11. 100%[=======================>] 23,763,585 373KB/s in 59s 12. 13. 2023-04-04 16:00:32 (392 KB/s) - ‘latest-zh_CN.tar.gz’ saved [23763585/23763585] 14. 15. [root@Web01 code]# tar xf latest-zh_CN.tar.gz 16. [root@Web01 code]# chown -R www.www /code/wordpress/
第四步:Windows本地hosts解析,浏览器访问blog.koten.com,发现需要依赖数据库,所以我们手动建立数据库
1. [root@Web01 code]# mysql -uroot -pkoten.vip -e "create database wordpress" 2. [root@Web01 code]# mysql -uroot -pkoten.vip -e "show databases" 3. +--------------------+ 4. | Database | 5. +--------------------+ 6. | information_schema | 7. | mysql | 8. | performance_schema | 9. | test | 10. | wordpress | 11. +--------------------+
第五步:操作wordpress界面,配置信息
大功告成,可以通过blog.koten.com/wp-admin访问后台
blog.koten.com可以访问博客主页
我是koten,10年运维经验,持续分享运维干货,感谢大家的阅读和关注!