Difference between revisions of "Create Site Copy From Dev55"
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | Copy the | + | Copy the remote (web) folder over to your server directory |
− | rsync -av | + | rsync -av (remote):/var/www/server/(sitename)/web/ (sitename) |
NOTE: in the following you'll see (user) (dbname) and (pword) | 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. | 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 remote inside the web directory) | |
+ | wp export db ~/(sitename).sql | ||
− | + | Create the database on your localhost - wp-cli way (inside your copy) | |
− | + | wp db create | |
− | + | copy over the database | |
− | + | scp (remote):(dumplocation).sql . | |
− | + | ||
− | + | ||
− | + | ||
− | Edit the file and replace the dev55 site url with your new localhost. In vim. | + | Import the database - use the same info as was used in the wp-config.php on remote - wp-cli way (inside web your copy) |
− | + | wp db import (dumplocation).sql | |
+ | |||
+ | Edit the file and replace the dev55 site url with your new localhost. In vim. - wp-cli way | ||
+ | wp search-replace 'oldsite.gaslightmedia.com' 'newsite.localhost' --all-tables | ||
− | |||
− | |||
Add new site file for nginx. | Add new site file for nginx. | ||
− | Edit your /etc/hosts file to use sitename.localhost | + | |
+ | If this is the first time you're creating site copies: | ||
+ | cd /etc/nginx/sites-available/ | ||
+ | cp default newsite | ||
+ | sudo vim newsite | ||
+ | ## 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/newsite | ||
+ | ## Change the server_name to newsite.localhost; | ||
+ | cd ../sites-enabled/ | ||
+ | sudo ln -s ../sites-available/newsite ./ | ||
+ | sudo service nginx restart | ||
+ | |||
+ | Should have a line for location | ||
+ | <pre> | ||
+ | location / { | ||
+ | # This is cool because no php is touched for static content. | ||
+ | # include the "?$args" part so non-default permalinks doesn't break when using query string | ||
+ | try_files $uri $uri/ /index.php?$args; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | Edit your /etc/hosts file to use (sitename).localhost | ||
+ | sudo vim /etc/hosts | ||
+ | ## add the line: 127.0.0.1 newsite.localhost |
Latest revision as of 16:49, 7 February 2019
Copy the remote (web) folder over to your server directory
rsync -av (remote):/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 remote inside the web directory)
wp export db ~/(sitename).sql
Create the database on your localhost - wp-cli way (inside your copy)
wp db create
copy over the database
scp (remote):(dumplocation).sql .
Import the database - use the same info as was used in the wp-config.php on remote - wp-cli way (inside web your copy)
wp db import (dumplocation).sql
Edit the file and replace the dev55 site url with your new localhost. In vim. - wp-cli way
wp search-replace 'oldsite.gaslightmedia.com' 'newsite.localhost' --all-tables
Add new site file for nginx.
If this is the first time you're creating site copies:
cd /etc/nginx/sites-available/ cp default newsite sudo vim newsite ## 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/newsite ## Change the server_name to newsite.localhost; cd ../sites-enabled/ sudo ln -s ../sites-available/newsite ./ sudo service nginx restart
Should have a line for location
location / { # This is cool because no php is touched for static content. # include the "?$args" part so non-default permalinks doesn't break when using query string try_files $uri $uri/ /index.php?$args; }
Edit your /etc/hosts file to use (sitename).localhost
sudo vim /etc/hosts ## add the line: 127.0.0.1 newsite.localhost