Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Apache not recognising the hostname
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dansou90
n00b
n00b


Joined: 13 Apr 2012
Posts: 65

PostPosted: Sun May 06, 2012 7:44 pm    Post subject: [Solved] Apache not recognising the hostname Reply with quote

Hello,

I've got a little problem. Every time I start my apache it says

Code:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


I am aware that other people had this problem, too. I solved it a few years ago on a Debian system which is running fine right now, and tried to fix it the same way in Gentoo, but it didn't work. Thats what I tried so far:

in /etc/hosts, I've done this (these are the settings from my Debian system):

Code:
127.0.0.1       localhost
127.0.0.1       daniel-pc


In my vhosts I've added the ServerName directive with the right hostname (daniel-pc).

In case it is important: I am using ssl with a self signed certificate and a RewriteRule for port 80, so all requests will be redirected to port 443. I copied the config over from my Debian system:

Code:
<VirtualHost *:80>
        ServerName daniel-pc
        RewriteEngine On
        RewriteCond %{HTTPS} !=on
        RewriteRule ^/(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R]

        <IfModule mpm_peruser_module>
                ServerEnvironment apache apache
        </IfModule>
</VirtualHost>


My config for the ssl vhost looks this way:

Code:
<VirtualHost _default_:443>
        ServerName daniel-desktop
        Include /etc/apache2/vhosts.d/default_vhost.include
        ErrorLog /var/log/apache2/ssl_error_log

        <IfModule log_config_module>
                TransferLog /var/log/apache2/ssl_access_log
        </IfModule>

        SSLEngine on

        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

        SSLCertificateFile /etc/ssl/apache2/daniel-pc.crt

        SSLCertificateKeyFile /etc/ssl/apache2/daniel-pc.key
        ServerName daniel-pc
        SSLOptions StrictRequire
        SSLProtocol all -SSLv2

        DocumentRoot /var/www/localhost/htdocs
        <Directory /var/www/localhost/htdocs/>
                SSLRequireSSL
                Order Deny,Allow
                Allow from All
        </Directory>

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>

        <Directory "/var/www/localhost/cgi-bin">
                SSLOptions +StdEnvVars
        </Directory>

        <IfModule setenvif_module>
                BrowserMatch ".*MSIE.*" \
                        nokeepalive ssl-unclean-shutdown \
                        downgrade-1.0 force-response-1.0
        </IfModule>
        <IfModule log_config_module>
                CustomLog /var/log/apache2/ssl_request_log \
                        "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
        </IfModule>
</VirtualHost>


Apache is running just fine, but this error bothers me... is there any way getting rid of it?


Last edited by dansou90 on Mon May 07, 2012 11:00 am; edited 1 time in total
Back to top
View user's profile Send private message
sebaro
Veteran
Veteran


Joined: 03 Jul 2006
Posts: 1141
Location: Romania

PostPosted: Mon May 07, 2012 10:58 am    Post subject: Reply with quote

$ echo "ServerName localhost" >> /etc/apache2/httpd.conf
Back to top
View user's profile Send private message
dansou90
n00b
n00b


Joined: 13 Apr 2012
Posts: 65

PostPosted: Mon May 07, 2012 11:00 am    Post subject: Reply with quote

Thank you sebaro, adding the ServerName directive to httpd.conf worked!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum