web-dev-qa-db-ja.com

サーバーの完全修飾ドメイン名を確実に特定できませんでした

Centos 7で2つの仮想ホストをセットアップするための this チュートリアルに従っていました。

問題は、httpdの再起動中に次のエラーが発生することです。

[userme@server ~]$ Sudo systemctl restart httpd.service 
[Sudo] password for userme: 
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

私の構成は

[userme@server ~]$ cat /etc/hosts
127.0.0.1   server.workstation.com server
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

[userme@server ~]$ hostname
server.workstation.com

[userme@server ~]$ cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=server


[userme@server ~]$ cat /etc/resolv.conf 
# Generated by NetworkManager
search workstation.com
nameserver fe80::1%p3p1
nameserver 192.168.100.1


[userme@server ~]$ domainname 
(none)

リクエストごとに編集

[userme@server ~]$ systemctl status httpd -l
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2018-01-18 12:55:25 +04; 57min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 1285 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 1283 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 1283 (code=exited, status=1/FAILURE)

Jan 18 12:55:25 server.workstation.com systemd[1]: Starting The Apache HTTP Server...
Jan 18 12:55:25 server.workstation.com httpd[1283]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using server.workstation.com. Set the 'ServerName' directive globally to suppress this message
Jan 18 12:55:25 server.workstation.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 18 12:55:25 server.workstation.com kill[1285]: kill: cannot find process ""
Jan 18 12:55:25 server.workstation.com systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 18 12:55:25 server.workstation.com systemd[1]: Failed to start The Apache HTTP Server.
Jan 18 12:55:25 server.workstation.com systemd[1]: Unit httpd.service entered failed state.
Jan 18 12:55:25 server.workstation.com systemd[1]: httpd.service failed.


[userme@server ~]$ Sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: p3p1
  sources: 
  services: ssh dhcpv6-client
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

[userme@server ~]$ apachectl configtest
Syntax OK

ネットワーク/ホスト名の設定の問題は何ですか?任意の助けいただければ幸いです。

1
ran

これは、CentOS 7でデフォルトで有効になっているSELINUXの問題のようです。

設定SELINUX=permissiveおよびサーバーを再起動すると、問題が/var/log/audit/audit.logに記録されるため、適切なSELINUX設定を設定して、SELINUXがサーバーを保護できるようにすることができます。

さらに、firewalldを設定して、ポート80および443へのアクセスを許可し、外部接続を許可する必要があります。

firewall-cmd --add-service=http
firewall-cmd --add-service=https

linodeにはfirewalldの適切な記述があります ですが、適切なSELINUXリソースが見つかりません...

3
fcbsd

エラーメッセージに従って:Set the 'ServerName' directive globally to suppress this message

以内 httpd.confファイルServerNameを見つけると、その上に次のメモが表示されることがあります。

ServerName gives the name and port that the server uses to identify itself.
This can often be determined automatically, but we recommend you specify
it explicitly to prevent problems during startup.

If your Host doesn't have a registered DNS name, enter its IP address here.

したがって、次の行を追加します。

ServerName server:[PORT]

起動の問題を修正する必要があります。

3
Centimane