Alexandre Takacs
asked on
Typical (?) apache newbie question... Could not reliably determine the server's fully qualified domain name
I'm having an issue (probably trivial) setting up apache under Ubuntu 18.04.2 (if fact I want to run NextCloud 16.0.1 on it).
Apache would not run with the following message:
Apache would not run with the following message:
-- Unit apache2.service has begun starting up.
Jun 19 23:54:35 nextcloud apachectl[10836]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive
Jun 19 23:54:36 nextcloud apachectl[10836]: Action 'start' failed.
Jun 19 23:54:36 nextcloud apachectl[10836]: The Apache error log may have more information.
Jun 19 23:54:36 nextcloud systemd[1]: apache2.service: Control process exited, code=exited status=1
Jun 19 23:54:36 nextcloud systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 19 23:54:36 nextcloud systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit apache2.service has failed.
--
-- The result is RESULT.
Jun 19 23:54:36 nextcloud sshd[10869]: Did not receive identification string from 192.168.0.64 port 54010
yet my config file has a ServerName directive as follows<VirtualHost *:443>
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
# Header always set Referrer-Policy "strict-origin"
SSLEngine on
### YOUR SERVER ADDRESS ###
ServerAdmin it@domain.com
ServerName mycloud.domain.com
# ServerAlias subdomain.example.com
### SETTINGS ###
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php/php7.2-fpm.nextcloud.sock|fcgi://localhost"
</FilesMatch>
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Satisfy Any
</Directory>
<IfModule mod_dav.c>
Dav off
</IfModule>
<Directory "/mnt/ncdata">
# just in case if .htaccess gets disabled
Require all denied
</Directory>
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<Files ".ht*">
Require all denied
</Files>
# Disable HTTP TRACE method.
TraceEnable off
# Disable HTTP TRACK method.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACK
RewriteRule .* - [R=405,L]
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
### LOCATION OF CERT FILES ###
SSLCertificateFile /etc/ssl/private/stardomain.pem
SSLCertificateKeyFile /etc/ssl/private/stardomain.key
</VirtualHost>
what am I missing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note: "Could not reliably determine the server's fully qualified domain name" has no bearing on Apache failing to start.
I normally set the following to address this.
Where "foo" is either a machine name or a LXD/Docker container name.
I normally set the following to address this.
# /etc/apache2/apache2.conf
ServerName foo
# /etc/hosts
127.0.0.1 foo
Where "foo" is either a machine name or a LXD/Docker container name.
better NOT remove localhost from the 127.0.0.1 address line. This may upset some software looking for that name.
noci is correct, my /etc/hosts line above is meant to be added to /etc/hosts, not replace /etc/hosts.
Best you leave your /etc/hosts file exactly as-is, because many hosting companies add network specific cruft to /etc/hosts which if removed... will cause what noci suggested... where "upset software" might means some/all services on your machine lose connectivity.
Good mention noci!
Best you leave your /etc/hosts file exactly as-is, because many hosting companies add network specific cruft to /etc/hosts which if removed... will cause what noci suggested... where "upset software" might means some/all services on your machine lose connectivity.
Good mention noci!
ASKER
Thanks - it was indeed all that was missing. Server up & running !
Now as I like to understand how things are working what did I do exactly by "binding" the FQDN to the local machine IP ? Care to elaborate ?
Now as I like to understand how things are working what did I do exactly by "binding" the FQDN to the local machine IP ? Care to elaborate ?
Basically Apache needs to make sure it knows where the host is when it starts
On windows you have a host file in C:/windows/system32/driver s/etc/host s
And Linux is /etc/host
This file basically overrides dns so if you was working on a website migration for example but do not want to change the name servers of the domain until you are happy that the new host is fully functional you can add it to your computers host file flush the dns then you will see the new host and make the tweaks before changing the nameservers :)
Hope this helps.
Kenza
On windows you have a host file in C:/windows/system32/driver
And Linux is /etc/host
This file basically overrides dns so if you was working on a website migration for example but do not want to change the name servers of the domain until you are happy that the new host is fully functional you can add it to your computers host file flush the dns then you will see the new host and make the tweaks before changing the nameservers :)
Hope this helps.
Kenza
Likely reason this worked...
Is because you changed your Apache config.
Default configs on all Distros default to listen on *:80 so if this default was still in existence, the /etc/hosts entry is not required.
Best you restore default behavior via...
If you have additional questions about your setup, best open additional questions... one topic/question, for best answers.
127.0.0.1 mycloud.domain.com
Is because you changed your Apache config.
Default configs on all Distros default to listen on *:80 so if this default was still in existence, the /etc/hosts entry is not required.
Best you restore default behavior via...
a2ensite 000-default
service apache2 reload
If you have additional questions about your setup, best open additional questions... one topic/question, for best answers.
Better to start from the beginning + setup everything correctly.
Note: This process is fairly simple + if you've never done this before... might be useful to hire someone to go through the process once with you.
1) Choose a public domain name as mycloud.domain.com will never work, as it's highly unlikely you own domain.com yourself.
2) Generate an SSL cert for domain from #1, as the SSL setup you have... won't work as you might expect... For SSL to work, the related domain + certs must actually be real + correct.
If your domain name is foo.com then you'll generate a cert like this...
Open in new window
3) Then use a working Apache config file. Here's a copy of the template I use for this... changing WEBSITE to foo.com (your real domain name).
Open in new window
4) My logging.conf file.
Open in new window