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?

ミドルウェアのインストールからポート開放まで

Posted at

概要

Rocky Linux でのミドルウェアインストールからポート解放までの一連の作業をまとめる
Apache(ウェブサーバー)を例にする

インストール

Apacheのインストールは過去記事参照
パッケージ管理ツールdnfを使ってみた

サービス起動と起動確認

  • systemctl を使う
  • Active: active(running)となっていればOK
// サービス開始
[root@marmoset ~]# systemctl start httpd

// サービス確認
[root@marmoset ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
     Active: active (running) since Wed 2024-07-03 15:35:41 JST; 6s ago
       Docs: man:httpd.service(8)
   Main PID: 4562 (httpd)
     Status: "Started, listening on: port 80"

// (参考)サービス停止
[root@marmoset ~]# systemctl stop httpd

// (参考)サービス再起動
[root@marmoset ~]# systemctl restart httpd

自動起動設定と設定確認

// 自動起動設定
[root@marmoset ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

// 設定確認
[root@marmoset ~]# systemctl is-enabled httpd
enabled

// (参考)自動起動設定を解除
[root@marmoset ~]# systemctl disable httpd

ポート開放と開放確認

Apacheのデフォルトポート80番を開放する
簡易的にサービス名で指定

// ポート開放
[root@marmoset ~]# firewall-cmd --add-service=http --zone=public --permanent
success

// (参考)開放済みのポートを開放しようとすると警告メッセージが表示される
[root@marmoset ~]# firewall-cmd --add-service=http --zone=public --permanent
Warning: ALREADY_ENABLED: http
success

// ファイアウォールリロード
[root@marmoset ~]# firewall-cmd --reload
success

ポートの開放状況を調べる
services: に http があればOK

[root@marmoset ~]# firewall-cmd --list-all --zone=public
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3 enp0s8
  sources:
  services: cockpit dhcpv6-client http ssh
  ports: 3000/tcp
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

導通確認

ホストOSのブラウザで https://192.168.56.130/ を開く。
HTTP Server Test Page が表示されればOK

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?