Skip to content

Instantly share code, notes, and snippets.

@Sunnyztj
Last active February 20, 2020 00:07
Show Gist options
  • Save Sunnyztj/159ba92737814a9d6858 to your computer and use it in GitHub Desktop.
Save Sunnyztj/159ba92737814a9d6858 to your computer and use it in GitHub Desktop.
wordpress setup
sudo adduser deploy
sudo adduser deploy sudo
su deploy
sudo apt-get update
sudo apt-get install lamp-server^ php5-gd libssh2-php
sudo mysql -u root -p
CREATE DATABASE wordpressdb;
CREATE USER wpuser@localhost IDENTIFIED BY 'pa$$w0rd';
GRANT ALL PRIVILEGES ON wordpressdb.* TO wpuser@localhost;
FLUSH PRIVILEGES;
exit
wget http://wordpress.org/latest.tar.gz
tar zxvf latest.tar.gz
cd ~/wordpress
cp wp-config-sample.php wp-config.php
edit wp-config.php:
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
https://api.wordpress.org/secret-key/1.1/salt/
define('AUTH_KEY', '`+7nTNb<AwtbLA$L-Q7amn;~|wH)ljXv2~TpbP?mLA+M`8H|n1`/Lz-GmAQL{4fB');
define('SECURE_AUTH_KEY', '/gkAjhhJe`iwO)V-p=J<cN_ +6D{YhrM|=E#C7gD}]c2w~OJ} y}eY^,HWn&-j:a');
define('LOGGED_IN_KEY', 'PtDl2V|01oIXDpq^K,IH-8|rhT +T(ZMpuLq>UD?|W)b3gMfG~g[zr8N6}m%MZ|L');
define('NONCE_KEY', ']Zj5i*hHlsUWKg2|>YF,X+xpd-_`I[nFmA6ZLw~;EW7g0.s5EaZCAJ=j]./5z^X~');
define('AUTH_SALT', 'e*l:hUsddFIxm1E7y-n#<a0|u- #+SsS@-#$vNz}EY4rY~-x|0_6=Q!TR=MMxUL?');
define('SECURE_AUTH_SALT', 'n]^c9nY>_}3,4)J]S sM6-MI3aB#Qk<Re^j#Lu_|x^*BhO.54aZQTtzJeCo5DWAg');
define('LOGGED_IN_SALT', 'Ba3kd1&J$~~`(|uJ0:v;w+DJ3xW}.B#R9J*r|.+V}*sTuK &8db-Mn+[boHW3{[/');
define('NONCE_SALT', 'nBv-U1qfkCZxS|13%hYdHz*s1^){.KSZWm1A^${`r!d5;EqrH:>1Xx`pwt6?**i}');
sudo rsync -avP ~/wordpress/ /var/www/html/
cd /var/www/html/
sudo rm index.html
sudo chown -R deploy:www-data *
mkdir /var/www/html/wp-content/uploads
sudo chown -R :www-data /var/www/html/wp-content/uploads/
sudo chown -R www-data:www-data /var/www/html/
sudo vim /etc/apache2/sites-available/000-default.conf
sudo a2enmod rewrite
sudo service apache2 restart
touch /var/www/html/.htaccess
sudo chown :www-data /var/www/html/.htaccess
chmod 664 /var/www/html/.htaccess
edit /etc/apache2/enabled-available/000-default.confg
### <Directory /var/www/html/>
### Allowoverride All
### </Directory>
chmod setting
https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress
# sudo find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
# sudo find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
sudo find . -type d -exec chmod 750 {} \;
sudo find . -type f -exec chmod 640 {} \;
xml-rpc-attacks
https://www.digitalocean.com/community/tutorials/how-to-protect-wordpress-from-xml-rpc-attacks-on-ubuntu-14-04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment