Difference between revisions of "Create Site Copy From Dev55"

From GLMWiki
Jump to: navigation, search
Line 9: Line 9:
 
copy the database (from dev55) [no space between -p and the password]
 
copy the database (from dev55) [no space between -p and the password]
 
  mysqldump -u (user) -p(pword) (dbname) > fileName.sql
 
  mysqldump -u (user) -p(pword) (dbname) > fileName.sql
 +
- wp-cli way (inside web directory)
 +
wp export db ~/(sitename).sql
  
 
Create the database on your localhost
 
Create the database on your localhost
Line 15: Line 17:
 
  grant usage on *.* to (user)@localhost identified by '(pword)';
 
  grant usage on *.* to (user)@localhost identified by '(pword)';
 
  grant all privileges on (dbname).* to (user)@localhost;
 
  grant all privileges on (dbname).* to (user)@localhost;
 +
- wp-cli way (inside your copy)
 +
wp db create
  
 
Rsync over the database
 
Rsync over the database
Line 23: Line 27:
  
 
Import the database - use the same info as was used in the wp-config.php on dev55
 
Import the database - use the same info as was used in the wp-config.php on dev55
  mysql -u (user) -p(pword) (dbname) < fileName.sql
+
  mysql -u (user) -p(pword) (dbname) < (dumplocation).sql
 +
- wp-cli way (inside web your copy)
 +
wp db import (dumplocation).sql
  
 
Add new site file for nginx.
 
Add new site file for nginx.
  
Edit your /etc/hosts file to use (sitename).localhost
 
sudo vim /etc/hosts
 
## add the line: 127.0.0.1 mountpleasantwow.localhost
 
 
 
If this is the first time you're creating site copies:
 
If this is the first time you're creating site copies:
 
  cd /etc/nginx/sites-available/
 
  cd /etc/nginx/sites-available/
Line 41: Line 43:
 
  sudo ln -s ../sites-available/mountpleasantwow ./
 
  sudo ln -s ../sites-available/mountpleasantwow ./
 
  sudo service nginx restart
 
  sudo service nginx restart
 +
 +
 +
Edit your /etc/hosts file to use (sitename).localhost
 +
sudo vim /etc/hosts
 +
## add the line: 127.0.0.1 mountpleasantwow.localhost

Revision as of 10:47, 26 October 2017

Copy the dev55 (web) folder over to your server directory

rsync -av dev55:/var/www/server/(sitename)/web/ (sitename)

NOTE: in the following you'll see (user) (dbname) and (pword) These are found in the sites wp-config.php file. You will need to replace the (user) with user etc.

Make sure permissions are good. Group writable

copy the database (from dev55) [no space between -p and the password]

mysqldump -u (user) -p(pword) (dbname) > fileName.sql

- wp-cli way (inside web directory)

wp export db ~/(sitename).sql

Create the database on your localhost

mysql -u root -p
create database (dbname);
grant usage on *.* to (user)@localhost identified by '(pword)';
grant all privileges on (dbname).* to (user)@localhost;

- wp-cli way (inside your copy)

wp db create 

Rsync over the database

rsync -av dev55:(dumplocation).sql .

Edit the file and replace the dev55 site url with your new localhost. In vim.

:%s;mountpleasantwow.gaslightmedia.com;mountpleasantwow.localhost;g

Import the database - use the same info as was used in the wp-config.php on dev55

mysql -u (user) -p(pword) (dbname) < (dumplocation).sql

- wp-cli way (inside web your copy)

wp db import (dumplocation).sql

Add new site file for nginx.

If this is the first time you're creating site copies:

cd /etc/nginx/sites-available/
cp default mountpleasantwow
sudo vim mountpleasantwow
## Comment out the two listen lines at the start of server {
## Change the 'root' line to suit the new location e.g. /var/www/server/mountpleasantwow
## Change the server_name to mountpleasantwow.localhost;
cd ../sites-enabled/
sudo ln -s ../sites-available/mountpleasantwow ./
sudo service nginx restart


Edit your /etc/hosts file to use (sitename).localhost

sudo vim /etc/hosts
## add the line: 127.0.0.1 mountpleasantwow.localhost