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?

OCIのOracle LinuxにいれたWebサーバが動かないときの調べ方

0
Last updated at Posted at 2026-08-11

前の記事

OCIのOracle LinuxにいれたWebサーバでプログラム(cgi)を動かす(nginx + cgi[perl])

困ったこと

なんかWebサーバが動いてない・・・。

1.nginx動作状態の確認

nginx動作状態確認コマンド

nginx動作状態確認コマンド

[opc@test-server ~]$ sudo systemctl status nginx

nginx動作状態正常時

● nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: di>
     Active: active (running) since Sat 2026-99-99 99:99:99 XXX; 23h ago
    Process: 2244 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, stat>
    Process: 2254 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCES>
    Process: 2329 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
   Main PID: 2371 (nginx)
      Tasks: 3 (limit: 2260)
     Memory: 2.0M (peak: 9.6M)
        CPU: 1.706s
     CGroup: /system.slice/nginx.service
             tq2371 "nginx: master process /usr/sbin/nginx"
             tq2372 "nginx: worker process"
             mq2375 "nginx: worker process"

Xxx 99 99:99:99 test-server systemd[1]: Starting The nginx HTTP and reverse pro>
Xxx 99 99:99:99 test-server nginx[2254]: nginx: the configuration file /etc/ngi>
Xxx 99 99:99:99 test-server nginx[2254]: nginx: configuration file /etc/nginx/n>
Xxx 99 99:99:99 test-server systemd[1]: Started The nginx HTTP and reverse prox>

nginx動作状態ダメな時

 ● nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: di>
     Active: failed (Result: exit-code) Xxx 2099-99-99 99:42:39 JST; 23h ago
    Process: 2244 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, stat>
    Process: 2254 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)

2.nginx設定の確認

nginx設定確認コマンド

nginx設定ファイル確認コマンド

[opc@test-server ~]$ sudo nginx -t

nginx設定ファイル正常時

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

syntax is ok、test is successfulになって問題なし。

3.nginx利用ポートの競合確認

nginx利用ポートとの競合確認コマンド

ポート競合確認コマンド

[opc@test-server ~]$ sudo ss -tlnp | grep -E ':80 |:443 '

ポート競合確認正常時

[opc@test-server ~]$

:80と:443がいない場合表示されないので問題なし。

ポートを利用しているとき(以下はhttpdが動いている問い)

LISTEN 0      511          0.0.0.0:80         0.0.0.0:*    users:(("httpd",pid=99999,fd=9),("nginx",pid=99999,fd=9),("nginx",pid=56534,fd=6))
LISTEN 0      511             [::]:80            [::]:*    users:(("httpd",pid=99999,fd=9),("nginx",pid=99999,fd=9),("nginx",pid=56534,fd=7))
LISTEN 0      511          0.0.0.0:443        0.0.0.0:*    users:(("httpd",pid=99999,fd=9),("nginx",pid=99999,fd=9),("nginx",pid=56534,fd=6))
LISTEN 0      511             [::]:443           [::]:*    users:(("httpd",pid=99999,fd=9),("nginx",pid=99999,fd=9),("nginx",pid=56534,fd=7))

httpdを動かなさないよう変更にする。

停止して無効化する

[opc@test-server ~]$ sudo systemctl stop httpd
[opc@test-server ~]$ sudo systemctl disable httpd

4.nginxエラーログの確認

nginxエラーログの確認

nginxエラーログの確認コマンド

[opc@test-server ~]$ sudo cat /var/log/nginx/error.log

エラーがあったら、エラーを見て修正する。

5.SELinuxエラーの対応

SELinuxエラー対応

最後に

記事の内容はCC BY-SA 4.0(著作者の情報とCCライセンス継承はお願いします。商用利用・改変・再配布は問題なし)です。

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?