项目作者: aoliverwd

项目描述 :
Lando LAMP stack
高级语言: PHP
项目地址: git://github.com/aoliverwd/lando-wp-lamp-stack.git
创建时间: 2020-10-28T23:16:29Z
项目社区:https://github.com/aoliverwd/lando-wp-lamp-stack

开源协议:

下载


Lando - WordPress LAMP Stack

Local Development Environment

Local development environment is handled via Lando. Lando documentation can be viewed here

Setup, install and run Lando

1. Environment Variables

  1. Save dotenv-example as .env in the same root folder.
  2. Open .env file and amend vales. For database credentials please refer to the lando lamp documentation or use the below:
  1. DB_HOST=database
  2. DB_PASSWORD=lamp
  3. DB_NAME=lamp
  4. DB_USER=lamp

2. Configure Lando

Lando configuration can be amended via the .lando.yml file. For more information on configureing the Lando development environment please refer to the Lando documentation.

If Lando is not installed, head over to Lando documentation for system requirements and installation instructions

3. Run Lando

Once configured cd into the project directory. Lando can be ran via the below CLI command:

  1. lando start

After a successful start up you should see something similar to the below:

  1. NAME website-local
  2. LOCATION
  3. SERVICES appserver, database, phpmyadmin
  4. APPSERVER URLS https://localhost:50853
  5. http://localhost:50854
  6. http://website-local.lndo.site/
  7. https://website-local.lndo.site/
  8. PHPMYADMIN URLS http://localhost:50852

Database access, Source files and Services

Database access

Access to the instance database can made via the PHPMyAdmin service.

4. Importing a database

Instructions form importing a database via the Lando CLI can be found on the official Lando documentation. Alternatively enter the below command via the Lando CLI:

  1. lando example-database/lamp.2022-01-18-1642497258.sql.gz

5. Update absolute paths in the Database

Absolute paths will require amending when creating another site instance. This can be achieved by executing the below SQL queries via the mysql CLI. The below CLI command Drops into a MySQL shell on the Lando database service:

  1. lando mysql lamp

Note: Ensure the OLD_URL and NEW_URL variables are amended with the required URL’s

  1. UPDATE wp_options SET option_value = replace(option_value, 'OLD_URL', 'NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
  2. UPDATE wp_posts SET guid = replace(guid, 'OLD_URL','NEW_URL');
  3. UPDATE wp_posts SET post_content = replace(post_content, 'OLD_URL', 'NEW_URL');
  4. UPDATE wp_postmeta SET meta_value = replace(meta_value,'OLD_URL','NEW_URL');
  5. UPDATE wp_options SET option_value = replace(option_value, 'OLD_URL', 'NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
  6. UPDATE wp_posts SET guid = replace(guid, 'OLD_URL','NEW_URL');
  7. UPDATE wp_posts SET post_content = replace(post_content, 'OLD_URL', 'NEW_URL');
  8. UPDATE wp_postmeta SET meta_value = replace(meta_value,'OLD_URL','NEW_URL');

Source files

By default this repository is setup to use WordPress. However any source files can be added to the project.

The Lando configuration in the repo exposes /public_html to port 80 so source files should be placed here.

WordPress Config

A default wp-config.php has been added to the /public_html. Do not change or remove this document.

Installing WordPress

  1. SSH into Lando instance: lando ssh
  2. CD into public_html folder: cd public_html
  3. Install latest WordpRess core files: php wp-cli.phar core download

WordPress Admin Login

Username: site.admin or dev@example.com
Password: zh02iI@cH6p*!RUO(v

Sending emails from Lando instance

It’s recommanded to use a external service like mailtrap.io