...
Code Block |
---|
SET @username = 'bluelight'; SET @password = MD5('BlueLight@WP'); SET @fullname = 'Blue Light Admin'; SET @email = 'bluelight@auroville.org.in'; SET @url = 'http://bluelightav.org/'; INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`) VALUES (@username, @password, @fullname, @email, @url, NOW(), '0', @fullname); SET @userid = LAST_INSERT_ID(); INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (@userid, 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (@userid, 'wp_user_level', '10'); |
Change domain name
Scenario: the site at old.name.org is to be changed to new.name.org .
Step 1: Wordpress config
Code Block |
---|
mv /etc/wordpress/conf-old.name.org.php /etc/wordpress/conf-new.name.org.php |
Step 2: Wordpress DB
The connection parameters can be found in {{/etc/wordpress/conf-new.name.org.php}} :
Code Block |
---|
mysql -u user_name -h localhost --password=secret db_name << EOF
UPDATE wp_options SET option_value = 'http://new.name.org' WHERE option_name = 'home' OR option_name = 'siteurl';
EOF |
Step 3: nginx config
Nginx can instruct browsers to use the new domain name, add this snippet in /etc/nginx/sites-available/wordpress_site_config_file
Code Block |
---|
server {
server_name old.name.org;
rewrite ^ $scheme://new.name.org$request_uri permanent;
} |
And, change the {{server_name}} attribute in the main server
block to: new.name.org
.
Step 4: Nginx frontend (web2)
Add new.name.org (and eventually {{*.new.name.org}}) to the server_name attribute in the relevant file in web2:/etc/nginx/sites-enabled/.