우분투에 워드 프레스 16.04 With Caddy

워드 프레스 is a famous content management system based on PHP and MySQL, distributed under the terms of the GNU GPLv2 (or later). In most cases it is installed by using Apache or NGINX as web servers, 또는, as we explained in 이 자습서, it can run on an isolated environment like Docker containers.

Alongside these choices, there is a new web server which is rapidly gaining popularity: Caddy.

Caddy (or Caddy web server), is an open source, HTTP/2 web server which enables HTTPS by default, without requiring external configuration. Caddy also has a strong integration with 하자 암호화.

This tutorial explains how to install and configure WordPress on top of your Caddy web server, installed following 우리의 가이드.

PHP 설치

As we said in the introduction, WordPress requires a web server, MySQL과 PHP. 우선, install PHP and the extensions required by WordPress, by executing the following command:

# apt-get install php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-mbstring php7.0-mcrypt php7.0-xml php7.0-xmlrpc

Verify that the PHP was correctly installed by checking its version:

$ php-v

설치 및 구성 MariaDB

MariaDB is also available in the repository, so just use apt:

# apt-get은 설치 mariadb 클라이언트 mariadb 서버

MariaDB 은는 MySQL fork, and it uses its name for the systemd service:

# systemctl 시작 mysql

설정 MariaDB root password to secure your database:

# mysql_secure_installation

You will be asked for the following configuration parameters:

Enter current password for root (enter for none): PRESS ENTER

Set root password? [Y/n] Y
ENTER YOUR PASSWORD

Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Once that step is complete you can access the MariaDB database with your password:

$ mysql-u 루트-p

Create New Database and User

Start the MariaDB shell:

$ mysql-u 루트-p

Use the MariaDB prompt to create a new database for WordPress. 이 자습서에서는, we use wordpressdb as the database name, and wordpressusr as the username for the WP installation. So our code looks like this:

mysql> 데이터베이스 만들기 wordpressdbDEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
mysql> 사용자 만들기 wordpressusr@localhost으로 식별 'usr_strong_password'; mysql> 에 모든 권한을 부여합니다 wordpressdb.* 받는 사람 wordpressusr@localhost으로 식별 'usr_strong_password';

다음, you can flush privileges and exit:

mysql> FLUSH PRIVILEGES;
mysql> 출구;

워드 프레스를 설치

Downloading and installing WordPress is quite an easy process, which requires executing just the following commands:

# cd /var/www
# wget wordpress.org/latest.zip
# latest.zip 지퍼

Change WordPress permissions with:

# chown -R www-data:www-data wordpress

Rename the WordPress config file and edit it:

# cd wordpress
# mv wp-설정-sample.php wp-config.php
# $EDITOR wp-config.php

여기, change the database informations, using those specified during the MariaDB configuration process:

DB_NAME = wordpressdb
DB_USER = wordpressusr
DB_PASSWORD = usr_strong_password

Configure Caddy and Start WordPress Installation Wizard

This tutorial assumes you installed Caddy web server already. Edit its configuration file:

# $EDITOR /etc/caddy/Caddyfile

이 파일에서, 다음과 같은 콘텐츠를 붙여 넣습니다.

example.com {
    tls [email protected]
    root /var/www/wordpress
    gzip
    fastcgi / /run/php/php7.0-fpm.sock php
    rewrite {
        if {path} not_match ^/wp-admin
        to {path} {path}/ /index.php?_url={uri}
    }
}

참고: [email protected] is the email address that will be used for Let’s Encrypt certificate request.

Restart Caddy:

# systemctl restart caddy

As a last step, with a web browser, go to your website. This will start the WordPress GUI installation wizard which will finish the installation process and give you access to the WordPress dashboard.

결론

At the end of the previous steps, a new WordPress instance will run on top of this new, tiny and powerful web server. Caddy will require certificates from Let’s Encrypt and enable automatically HTTPS connections, without any other manual configuration.

게시물 우분투에 워드 프레스 16.04 With Caddy 에 처음 등장 Unixmen.

답을 남겨주세요