WordPress Setup Guide for Ubuntu
Apache2 설치
sudo apt-get install -y apache2
Apache2 설정
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=[사용자 계정]
export APACHE_RUN_GROUP=[사용자 계정]
/etc/apache2/envvars 파일에서 위와 같이 수정한다. 사용자 계정에서 Apache 사용하기 위해서 APACHE_RUN_USER, APACHE_RUN_GROUP 값을 사용자 계정으로 입력한다.
<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 www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/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>
<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 www.example.com
DocumentRoot /home/park/Documents/WordPress
<Directory "/home/park/Documents/WordPress">
AllowOverride All
Options All
Require all Granted
</Directory>
# 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>
/etc/apache2/sites-enabled/000-default.conf 파일에서 DocumentRoot, Directory 부분들을 수정한다.
Apache2 재시작
sudo systemctl restart apache2
Rewrite 모듈 활성화
sudo a2enmod rewrite
MySQL 설치
sudo apt-get install -y mysql-server
MySQL 계정 생성
sudo mysql -u root
mysql> CREATE USER '[계정]'@'%' IDENTIFIED BY '[패스워드]';
mysql> GRANT ALL PRIVILEGES ON *.* TO '[계정]'@'%';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
MySQL 외부 접속 허용
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
#
/etc/mysql/mysql.conf.d/mysqld.cnf 파일에서 bind-address 부분을 주석처리한다.
MySQL 데이터베이스 생성
mysql> CREATE DATABASE WordPress DEFAULT CHARACTER SET UTF8;
mysql> EXIT;
MySQL 재시작
sudo /etc/init.d/mysql restart
PHP 설치
sudo apt-get install -y php php-curl php-soap php-xml php-mbstring php-gd php-mysql
WordPress 다운로드
sudo chmod o+w ./WordPress/ -R
wget -c "https://wordpress.org/latest.tar.gz" -O - | sudo tar -xz --strip 1 -C ./WordPress/
sudo chown [사용자 계정]:[사용자 계정] ./WordPress/ -R