우분투에서 워드프레스 설치하기
When you request a directory without specifying a filename, index.html will be given the priority and hence will be displayed. You can change the priority order in the dir.conf file.
vim /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html ...
</IfModule>
Enabling .htaccess Overrides
vim /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
...
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com/public_html
...
<Directory /var/www/example.com/public_html/>
...
AllowOverride All
...
</Directory>
...
</VirtualHost>
Enabling the Rewrite Module
a2enmod rewrite
Restart Apache
systemctl restart apache2
Create WordPress database
mysql -u root -p
Password generate using javascript
window.btoa('ubuntu') // PASSWORD
CREATE DATABASE wordpress;
CREATE USER 'ubuntu'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL ON wordpress.* TO 'ubuntu'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Downloading WordPress
Latest Version
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
Past Release Version
cd /tmp
curl -O https://wordpress.org/wordpress-5.9.3.tar.gz
tar xzvf wordpress-5.9.3.tar.gz
touch /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
mkdir /tmp/wordpress/wp-content/upgrade
cp -a /tmp/wordpress/. /var/www/example.com/public_html/
mkdir /var/www/example.com/logs/
Permission for owner
chown -R www-data:www-data /var/www/example.com/
chmod -R 755 /var/www/example.com/
Permission for group
chown -R www-data:www-data /var/www/example.com/
usermod -a -G www-data ubuntu
chmod -R 775 /var/www/example.com/
Update the WordPress Configuration File
curl -s https://api.wordpress.org/secret-key/1.1/salt/
vim /var/www/example.com/public_html/wp-config.php
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');