Difference between revisions of "Create Site Copy From Dev55"
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) | ||
Line 7: | Line 7: | ||
Make sure permissions are good. Group writable | Make sure permissions are good. Group writable | ||
− | copy the database (from | + | copy the database (from remote inside the web directory) |
− | + | ||
− | + | ||
wp export db ~/(sitename).sql | wp export db ~/(sitename).sql | ||
− | Create the database on your localhost | + | Create the database on your localhost - wp-cli way (inside your copy) |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | - wp-cli way (inside your copy) | + | |
wp db create | wp db create | ||
Line 23: | Line 16: | ||
rsync -av dev55:(dumplocation).sql . | rsync -av dev55:(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) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | Import the database - use the same info as was used in the wp-config.php on | + | |
− | + | ||
− | - wp-cli way (inside web your copy) | + | |
wp db import (dumplocation).sql | 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' | ||
+ | |||
Add new site file for nginx. | Add new site file for nginx. | ||
+ | |||
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/ | ||
− | cp default | + | cp default newsite |
− | sudo vim | + | sudo vim newsite |
## Comment out the two listen lines at the start of server { | ## 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/ | + | ## Change the 'root' line to suit the new location e.g. /var/www/server/newsite |
− | ## Change the server_name to | + | ## Change the server_name to newsite.localhost; |
cd ../sites-enabled/ | cd ../sites-enabled/ | ||
− | sudo ln -s ../sites-available/ | + | sudo ln -s ../sites-available/newsite ./ |
sudo service nginx restart | 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 | Edit your /etc/hosts file to use (sitename).localhost | ||
sudo vim /etc/hosts | sudo vim /etc/hosts | ||
− | ## add the line: 127.0.0.1 | + | ## add the line: 127.0.0.1 newsite.localhost |
Revision as of 10:58, 26 October 2017
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
Rsync over the database
rsync -av dev55:(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'
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