CentOS Stream 9にnginxをインストールする

OSバージョンを確認します
$ cat /etc/redhat-release
CentOS Stream release 9

nginxのインストール手順

1.nginx をインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf -y install nginx
# dnf -y install nginx
# dnf -y install nginx

2.nginxの基本設定を行います
# vi /etc/nginx/nginx.conf

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# 41行目 : サーバー名を自身のものに変更
server_name www.arkgame.com;
# 41行目 : サーバー名を自身のものに変更 server_name www.arkgame.com;
# 41行目 : サーバー名を自身のものに変更
server_name www.arkgame.com;

自動起動を設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable --now nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
# systemctl enable --now nginx Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
# systemctl enable --now nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

3.ファイアウォールを設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# firewall-cmd --add-service=http
success
# firewall-cmd --runtime-to-permanent
success
# firewall-cmd --add-service=http success # firewall-cmd --runtime-to-permanent success
# firewall-cmd --add-service=http
success
# firewall-cmd --runtime-to-permanent
success

4.動作確認
Web ブラウザーを起動し、http://192.168.71.152/」にアクセスして動作確認します
「HTTP SERVER TEST PAGE」が表示されます。

CentOS Stream 9

Posted by arkgame