Bedrock is a start-up WordPress template with modern development tools, simple configuration and improved file structure:
wp-content/
files and folders wp-content/
moved to app/
.env
configuration file.In addition, Bedrock can be supplemented with the wonderful Soil plugin and the Sage starting theme. The article describes the algorithm for deploying a project based on it in Ubuntu 16.04. The tutorial for installing Bedrock in Windows is here .
Installation requirements:
Installing the tasksel
command-line tasksel
sudo apt-get install tasksel
LAMP installation
sudo tasksel install lamp-server
To verify the installation, open localhost
in any browser. If the page titled "Apache2 Ubuntu Default Page" is displayed, the LAMP installation was successful.
In this example, the project folder: ~/www/example.local
In any text editor, create a file in the sudo vim /etc/apache2/sites-available/
folderexample.local.conf
. I do it like this:
sudo vim /etc/apache2/sites-available/example.local.conf
The content of the example.local.conf
file
<VirtualHost *:80> ServerName example.local DocumentRoot /home/eustatos/www/example.local/web <Directory /> Options Indexes FollowSimLinks Includes ExecCGI AllowOverride All Require all granted Allow from all </Directory> </VirtualHost>
We activate the site of our project
sudo a2ensite example.local
Next, make additions to the file /etc/hosts
127.0.0.2 example.local
This completes the host setup for our project.
Before installing Composer
sure that php
installed
php -v
If the php
version information is displayed, proceed to the next step.
composer
package manager php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
To install composer
globally run
chmod +x composer.phar sudo mv composer.phar /usr/bin/composer
To check the correct installation globally run
composer about
If the installation is correct, the composer
information will be displayed globally.
If php7.0 is installed, then you must additionally run:
sudo apt-get install php-xml
As mentioned above, our project is hosted ~/www/example.local
Copy the git repository with Bedrock:
cd ~/www git clone git@github.com:roots/bedrock.git example.local && cd example.local
If the SSH key is not installed on the local machine and github, run:
cd ~/www git clone https://github.com/roots/bedrock.git example.local
Execute
cd ~/www/example.local composer install
Recommended by developers
cd ~/www composer create-project roots/bedrock example.local
For both methods, if composer
installed locally, instead of composer
specify php {}composer.phar
.
Copy the .env.example
file to the .env
file
DB_NAME=wp_example DB_USER=wp_example DB_PASSWORD=password DB_HOST=localhost WP_ENV=development WP_HOME=http://example.local WP_SITEURL=${WP_HOME}/wp # Generate your keys here: https://roots.io/salts.html AUTH_KEY= SECURE_AUTH_KEY= LOGGED_IN_KEY= NONCE_KEY= AUTH_SALT=
The values of keys AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, MONCE_KEY, AUTH_SALT can be obtained by reference
Install WP-CLI Dotenv command
wp package install aaemnnosttv/wp-cli-dotenv-command:^1.0
After we create .env
and generate keys
wp dotenv init --template=.env.example --with-salts
If desired, you can change the other parameters as follows:
wp dotenv set DB_NAME wp_example wp dotenv set DB_USER wp_example wp dotenv set DB_PASSWORD password wp dotenv set DB_HOST localhost wp dotenv set WP_HOME http://example.local
$ mysql -u root -p mysql> CREATE USER 'wp_example'@'localhost' IDENTIFIED BY 'password'; mysql> CREATE DATABASE wp_example CHARACTER SET utf8 COLLATE utf8_general_ci; mysql> GRANT ALL PRIVILEGES ON wp_example.* TO 'wp_example'@'localhost';
Source: https://habr.com/ru/post/311270/
All Articles