2
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?

More than 5 years have passed since last update.

【Linux Nginx】Webサーバ初期設定で使うコマンド集

Last updated at Posted at 2019-12-04

ファイアウォールの設定


HTTP(TCPの80番ポートを空ける)を利用(現在の設定を変更して保存)
[user@host]$ sudo firewall-cmd --add-service http
[user@host]$ sudo firewall-cmd --add-service http --permanent
success

HTTPS(TCPの443番ポートを空ける)を利用(現在の設定を変更して保存)
[user@host]$ sudo firewall-cmd --add-service https
[user@host]$ sudo firewall-cmd --add-service https --permanent
success

nginx導入


インストール
sudo yum install nginx
途中で以下の質問があるのでyと回答
Total download size: 4.3 M
Installed size: 14 M
Is this ok [y/d/N]: y

nginx操作


開始
[user@host]$ sudo systemctl start nginx
終了
[user@host]$ sudo systemctl stop nginx
再起動
[user@host]$ sudo systemctl restart nginx
設定ファイル再読み込み
[user@host]$ sudo systemctl reload nginx
状態表示
[user@host]$ sudo systemctl status nginx -l

nginx エラーログの場所

/var/log/nginx/error.log

nginx 設定ファイル コメントアウト

シェルスクリプト同様「#」でコメントアウトが可能です。

参考

2
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
2
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?