wordpress가 잘 설치되었다. 마지막으로 wp-config-sample.php를 wp-config.php란 이름으로 복사해준다.
cp wp-config-sample.php wp-config.php
복사가 끝났으면 vi로 wp-config.php를 열어 DB 정보를 입력해준다. 이것으로 wordpress 설치는 끝났다. 나머지는 데이터베이스와 도메인을 연결해주기만 하면 된다.
이 글에서는 데이터베이스로 MySQL을 사용한다.
$ mysql -u "YOUR_ADMIN_USER" -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE DATABASE "YOUR_DATABASE_NAME";
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON "YOUR_DATABASE_NAME".* TO '"YOUR_WORDPRESS_USER"'@'"YOUR_HOST"'
-> IDENTIFIED BY '"YOUR_PASSWORD"';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> EXIT
Bye
$
wordpress로 사용할 계정을 만들었다면 도메인을 연결하면 된다.
이 글에선 apache를 이용한다.
cd /etc/apache2/sites-available/
sudo cp 000-default.conf "YOUR_DOMAIN.conf"
sudo vi "YOUR_DOMAIN.conf"
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName "YOUR_DOMAIN (ex > minseo.siya.co.kr)"
ServerAlias "YOUR_ALIAS_DOMAIN (ex > www.minseo.siya.co.kr)"
ServerAdmin webmaster@localhost
DocumentRoot "YOUR_WORDPRESS_DIR (ex > /home/minseo/www/html)"
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
이제 작성한 파일을 a2ensite를 이용하여 /etc/apache2/sites-enabled/ 로 옮긴다. 그 후 마지막으로 /etc/apache2/apache2.conf에서 디렉토리를 허가해주면 끝난다.
sudo a2ensite "YOUR_DOMAIN"
sudo vi /etc/apache2/apache2.conf