0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【RockyLinux 9.5 で WordPress 環境構築】Apacheのインストールと設定

Last updated at Posted at 2025-02-21

RockyLinux9.5でWordPress環境構築した際のメモです。
今回はWebサーバーApacheをインストールし設定します。

Apacheのインストール

「httpd」「httpd-tools」「mod_ssl」をインストール

sudo dnf install httpd httpd-tools mod_ssl

httpdを起動し、ステータスを確認

sudo systemctl start httpd
sudo systemctl status httpd

サーバを再起動しても自動的に起動するように設定

sudo systemctl enable httpd
sudo systemctl is-enabled httpd

ブラウザでサイトURL http://xxx.xxx.xxx.xxx (IPアドレス)にアクセスし、Apatchのテストページが表示れていれば成功です。

ドキュメントルートディレクトリの作成

sudo mkdir /var/www/html/yoursite.com
sudo mkdir chown apache.apache /var/www/html/yoursite.com/

設定ファイル(httpd.conf)の編集

オリジナルをバックアップ

sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org

vimで開いて編集

sudo vim /etc/httpd/conf/httpd.conf

以下の部分を編集します。

/etc/httpd/conf/httpd.conf
# ServerName www.example.com:80
ServerName yoursite.com:80
/etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"DocumentRoot "/var/www/html/yoursite.com"
/etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
↓
<Directory "/home/www/html/yoursite.com">
/etc/httpd/conf/httpd.conf
Options Indexes FollowSymLinksOptions FollowSymLinks
/etc/httpd/conf/httpd.conf
Options Indexes FollowSymLinksOptions FollowSymLinks
/etc/httpd/conf/httpd.conf
DirectoryIndex index.htmlDirectoryIndex index.php index.html

設定ファイルの確認

以下のコマンドでエラーが表示される場合、設定ファイルやディレクトリ構成に問題があります。

sudo httpd -t

Apacheを再起動

sudo systemctl restart httpd.service

RockyLinux9.5でWordPress環境構築

  1. さくらのVPS設定
  2. Apacheのインストールと設定
  3. PHPのインストールと設定
  4. mariaDBのインストールと設定
  5. WordPressのインストールと設定
  6. DNS設定とCertbotによるSSL証明書の取得と設定
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?