LoginSignup
60
53

More than 5 years have passed since last update.

CentOS7のhttpd設定で詰まった点

Posted at

初めてCentOS7を触ったのですが、いくつか詰まったところがあったのでまとめます。

serviceではなくsystemctlを使う

今までhttpdなどのサービスはserviceコマンドを使っていましたが、CentOS7からはsystemctlコマンドを使うことになります。

# sudo service httpd start の代わり
sudo systemctl start httpd.service

# sudo chkconfig httpd on の代わり
sudo systemctl enable httpd.service

末尾の.serivceは省略してもよいみたいです。

ファイアウォール設定を要確認

Firewall-cmdというファイアウォールが自動的に有効になっている場合があり、見落としがちです。

ポート80 (http) と 443 (https)を開けるには、下記のようにします。

firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

参考

Install Apache, PHP And MySQL On CentOS 7 (LAMP) | HowtoForge - Linux Howtos and Tutorials

60
53
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
60
53