taka.

taka./Photon OS 5 に WEB サーバを構築する

Created at Updated at
491 Words 2 min

はじめに

自宅ラボの Nested ESXi の自動インストールのために利用する WEB サーバを Photon OS 5 で構築した時の作業を備忘のために残しておく。
※本記事は簡易な WEB サーバを構築する手順を記載する

 

この記事を読んで欲しい人

  • Photon OS 5 を利用して同様に WEB サーバを構築したいと考えている人

 

WEB サーバ構築

  1. Photon OS に root ログインする

     

  2. 自宅ラボの動作確認を簡素化するためにファイアウォールを停止

    systemctl stop iptables
    
    Warning: The unit file, source configuration file or drop-ins of iptables.service changed on disk. Run 'systemctl daemon-reload' to reload units.
    
    systemctl disable iptables
    
    Removed "/etc/systemd/system/multi-user.target.wants/iptables.service".
    

     

  3. Apache HTTP Server 機能のパッケージをインストール

    tdnf install -y httpd
    

     

  4. httpd 起動

    systemctl start httpd
    

     

  5. httpd の自動起動を設定

    systemctl enable httpd
    
    Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
    

     

  6. httpd のステータスを確認
    正常に起動していることを確認する

    systemctl status httpd
    
    ● httpd.service - The Apache HTTP Server  
        Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)  
        Active: active (running) since Sat 2025-07-19 13:27:05 UTC; 1 day 15h ago  
        Process: 975 ExecStart=/usr/sbin/httpd -k start (code=exited, status=0/SUCCESS)  
    Main PID: 977 (httpd)  
        Tasks: 109 (limit: 2370)  
        Memory: 12.2M  
            CPU: 17.996s  
        CGroup: /system.slice/httpd.service  
                tq 977 /usr/sbin/httpd -k start  
                tq 978 /usr/sbin/httpd -k start  
                tq 979 /usr/sbin/httpd -k start  
                tq 980 /usr/sbin/httpd -k start  
                mq1112 /usr/sbin/httpd -k start  
    

     

  7. Apache HTTP Server バージョン確認
    いずれかのコマンドでバージョンを確認

    httpd -v
    
    apachectl -v
    
    Server version: Apache/2.4.62 (Unix)
    Server built:   May 27 2025 13:08:25
    

     

  8. テスト用コンテンツを作成

    echo '<h1>Test</h1>' > /etc/httpd/html/index.html
    

     

  9. テスト用コンテンツの取得確認
    curl コマンドに Photon OS の IP アドレス(192.168.1.251)を指定
    IP アドレス(192.168.1.251)はご自身の環境にお置き換えください

    curl 192.168.1.251
    
    <h1>Test</h1>
    

     

環境

  • Photon OS 5 (Build:b9d98344d)
  • Apache 2.4.62