CMSインストール · 4 min read · Dec 19, 2025

Ubuntu 22.04にLet's Encrypt SSLを使用してFlatpress CMSをインストールする方法

FlatPressは、無料でオープンソースの最も高速なコンテンツ管理システムです。PHP言語で書かれており、データベースアクセスがない人にとって素晴らしいツールです。軽量で、セットアップが簡単なブログエンジンであり、ソーシャル&コミュニケーションカテゴリにおいて優れています。複数の言語、プラグイン、テーマ、ウィジェットなどをサポートしています。

このチュートリアルでは、Ubuntu 22.04サーバーにFlatPressをインストールする方法を説明します。

要件

  • Ubuntu 22.04を実行しているサーバー。
  • sudo権限を持つ非rootユーザー。

ApacheとPHPのインストール

デフォルトでは、PHP 8.1がUbuntu 22.04のデフォルトPHPバージョンです。しかし、FlatPressはPHP 8.0バージョンのみをサポートしています。したがって、PHPリポジトリをシステムに追加する必要があります。次のコマンドで追加できます。

apt install software-properties-common -y  
add-apt-repository ppa:ondrej/php

リポジトリが追加されたら、次のコマンドを実行してApache、PHP、およびすべての必要なPHP拡張機能をインストールします。

apt-get install apache2 php8.0 php8.0-mysql php8.0-curl php8.0-cgi libapache2-mod-php8.0 php8.0-mcrypt php8.0-xmlrpc php8.0-gd php8.0-mbstring php8.0 php8.0-common php8.0-xmlrpc php8.0-soap php8.0-xml php8.0-intl php8.0-cli php8.0-ldap php8.0-zip php8.0-readline php8.0-imap php8.0-tidy php8.0-sql php8.0-intl wget unzip -y

すべてのパッケージのインストールが完了したら、次のコマンドを実行してApacheサービスを開始し、ブート時に自動的に開始するように設定します。

systemctl start apache2  
systemctl enable apache2

完了したら、次のステップに進むことができます。

FlatPressのインストール

まず、FlatPress Gitリポジトリにアクセスし、次のコマンドで最新バージョンをダウンロードします。

wget https://github.com/flatpressblog/flatpress/archive/1.2.1.zip

次に、次のコマンドでダウンロードしたファイルを解凍します。

unzip 1.2.1.zip

次に、抽出したディレクトリをApacheのルートディレクトリにコピーし、次のコマンドで適切な権限を設定します。

cp -r flatpress-1.2.1 /var/www/html/flatpress
chown -R www-data.www-data /var/www/html/flatpress  
chmod -R 775 /var/www/html/flatpress

FlatPress用のApacheの設定

次に、FlatPress用のApache仮想ホストファイルを作成する必要があります。次のコマンドで作成できます。

nano /etc/apache2/sites-available/flatpress.conf

次の行を追加します。


     ServerAdmin [email protected]
     DocumentRoot /var/www/html/flatpress
     ServerName flatpress.example.com

     
          AllowOverride All
          Require all granted
     

     ErrorLog ${APACHE_LOG_DIR}/flatpress_error.log
     CustomLog ${APACHE_LOG_DIR}/flatpress_access.log combined


ファイルを保存して閉じます。次に、次のコマンドで仮想ホストを有効にします。

a2ensite flatpress

次に、Apacheのリライトモジュールを有効にし、次のコマンドでApacheサービスを再起動します。

a2enmod rewrite  
systemctl restart apache2

次のコマンドでApacheのステータスを確認することもできます。

systemctl status apache2

次の出力が表示されるはずです。

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-11-20 11:37:30 UTC; 6s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 100768 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 100772 (apache2)
      Tasks: 6 (limit: 2242)
     Memory: 14.3M
        CPU: 85ms
     CGroup: /system.slice/apache2.service
             ??100772 /usr/sbin/apache2 -k start
             ??100773 /usr/sbin/apache2 -k start
             ??100774 /usr/sbin/apache2 -k start
             ??100775 /usr/sbin/apache2 -k start
             ??100776 /usr/sbin/apache2 -k start
             ??100777 /usr/sbin/apache2 -k start

Nov 20 11:37:30 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

完了したら、次のステップに進むことができます。

Let’s Encrypt SSLでFlatPressを保護する

FlatPressサイトをLet’s Encrypt SSL証明書で保護することは良いアイデアです。そのためには、システムにCertbotクライアントをインストールする必要があります。Certbotは、ウェブサイトのSSL証明書をダウンロードおよび管理するのに役立つクライアントパッケージです。

次のコマンドでCertbotをインストールできます。

apt-get install certbot python3-certbot-apache -y

Certbotクライアントが正常にインストールされたら、次のコマンドを実行してウェブサイトのLet’s Encrypt SSLをインストールします。

certbot --apache -d flatpress.example.com

有効なメールアドレスを提供し、以下のようにサービス利用規約に同意するよう求められます。

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for flatpress.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/flatpress-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/flatpress-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/flatpress-le-ssl.conf

次に、HTTPトラフィックをHTTPSにリダイレクトするか、すべてのトラフィックを安全なHTTPSアクセスにリダイレクトするようにNginxを設定するかを選択します。次の出力のように表示されます。

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2を入力してEnterを押してプロセスを開始します。インストールが完了すると、次の出力が表示されるはずです。

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/flatpress.conf to ssl vhost in /etc/apache2/sites-available/flatpress-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://flatpress.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=flatpress.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/flatpress.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/flatpress.example.com/privkey.pem
   Your cert will expire on 2023-02-20. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

この時点で、FlatPressサイトはLet’s Encrypt SSLで保護されています。HTTPSプロトコルを使用して安全にサイトにアクセスできます。

FlatPress CMSにアクセス

今、ウェブブラウザを開き、URL https://flatpress.example.com を入力します。FlatPressインストールページにリダイレクトされます:

FlatPress CMSインストーラー

次に、次へボタンをクリックします。管理者ユーザー作成ページが表示されるはずです:

ユーザーを作成

ここで、管理者のユーザー名、パスワード、メールアドレスを入力し、次へボタンをクリックします。次のページが表示されるはずです:

FlatPressインストール完了

今すぐログインボタンをクリックします。次のページが表示されるはずです:

FlatPressログイン

管理者のユーザー名、パスワードを入力し、ログインボタンをクリックします。次のページが表示されるはずです:

FlatPress管理

結論

このチュートリアルでは、Ubuntu 22.04でApacheとLet’s Encrypt SSLを使用してFlatPressをインストールする方法を説明しました。これで、FlatPress CMSを使用してシンプルで高速なウェブサイトとブログを作成できます。質問があればお気軽にお尋ねください。

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。