jefrancomix/composer-wordpress

具有高度自定义路径的 WordPress 意见性配置(再见 wp-content!)

0.2 2020-06-16 09:27 UTC

This package is auto-updated.

Last update: 2024-09-16 18:40:16 UTC


README

使用 composer 安装和部署 WordPress 网站的基配置

您的 WordPress 安装结构将如下所示

/.env              -> edit in this file the most common config constants
/vendor            -> You shouldn't touch anything here, 3rd party libraries
/public
/public/cms        -> the WordPress installation dir (managed by composer)
/public/index.php  -> custom WordPress bootstrap file
/public/media      -> the WordPress directory to store uploads
/public/extensions -> WordPress plugins, managed by composer
/public/must       -> WordPress must-use plugins
/public/themes     -> themes directory
/app/config/environments/{development,production,...}.php extra configuration

它使用 WordPress Packagist 来管理您的插件、主题和其他 PHP 依赖项

如何开始

步骤1:安装

要求

  • PHP7.1 或更高版本

创建您的项目

composer create-project jefrancomix/composer-wordpress your_directory_name "dev-master"

设置 WordPress 权限

# Configure the wp-content/uploads permissions
# https://codex.wordpress.org/Changing_File_Permissions
chmod -R 775 public/media

步骤2:配置

将 .env.example 复制到 .env 并自定义您的参数

配置其他常规 wp-config 参数

默认情况下,app/config/environments/development.php 中的文件可自定义,如果您需要自定义其他变量,您可以在该目录中创建其他文件,并通过在自定义 .env 文件中更改 WP_ENV 变量来加载其设置。

使用 Apache 和永久链接不起作用?

如果重写规则似乎不起作用,则可能是重写模块未启用,您可以在 Apache 配置中添加此行来调试此问题

# /etc/apache/apache2.conf in debian/ubuntu systems
LogLevel alert rewrite:trace6

然后重新启动 Apache 服务,如果日志文件显示

Cannot find module rewrite

您必须启用它才能使永久链接工作

# a2enmod rewrite
# service apache2 restart

这并不仅限于这种结构,对于在 Apache2 上运行的任何 WordPress 安装都是有效的。

鸣谢

simmetric/wordpress-composer-installationbedrock/roots 启发,并添加了一些 composer 安装脚本(主要是重写和复制文件)的魔力。