Results 1 to 10 of 10

Thread: How to set ServerName in Apache2?

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Beans
    4

    Unhappy How to set ServerName in Apache2?

    I've added these in the file /etc/apache2/httpd.conf

    <VirtualHost *>
    ServerName zhanjh_server
    DocumentRoot /var/www
    <Directory /var/www>
    AllowOverride All
    Options All
    </Directory>
    </VirtualHost>

    But when I reload or restart the apache2 I still got this:
    * Restarting web server apache2
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

    Thank you!

  2. #2
    Join Date
    Nov 2005
    Location
    NEK Vermont
    Beans
    Hidden!
    Distro
    Ubuntu UNR

    Re: How to set ServerName in Apache2?

    also put ServerName above the document root section in /etc/apache2/sites-available/default...or whatever virtual host you are using.

  3. #3
    Join Date
    Oct 2005
    Beans
    4

    Re: How to set ServerName in Apache2?

    I added the servername in the /etc/apache2/sites-available/default.But still not working.

    /etc/apache2/sites-available/default:
    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName zhanjh_server
    DocumentRoot /var/www
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>
    .....
    </VirtualHost>

  4. #4
    Join Date
    May 2007
    Location
    Phoenix, Arizona USA
    Beans
    2,909
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How to set ServerName in Apache2?

    Make sure your /etc/hosts has an entry for itself. Also, make sure your box name IS what you are trying to set it to in Apache. What is the return of the hostname command with no parameters?

    -Tim
    www.pcchopshop.net

    Hard to find and obsolete PC and server parts. "If we can't find it, it probably doesn't exist"

  5. #5
    Join Date
    Oct 2005
    Beans
    4

    Re: How to set ServerName in Apache2?

    Thank you Spiderbatdad and Windependence.Without your help I cannot resolve it.

    But I got a new problem. I found the error message in /var/log/apache2/error.log:
    [Sat May 09 22:27:58 2009] [notice] caught SIGTERM, shutting down
    [Sat May 09 22:27:59 2009] [notice] Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch configured -- resuming normal operations

    -------------------------------------------------------------
    PS:
    /etc/apache2/sites-available/default:
    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName zhanjh.com
    DocumentRoot /var/www
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>
    ....
    </VirtualHost>

    /etc/hosts:
    127.0.0.1 zhanjh.com localhost.localdomain localhost
    127.0.1.1 zhanjh.com

    /etc/hostname:
    zhanjh.com

  6. #6
    Join Date
    Apr 2007
    Location
    Pennsylvania
    Beans
    107
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How to set ServerName in Apache2?

    Quote Originally Posted by zhanjh View Post
    Thank you Spiderbatdad and Windependence.Without your help I cannot resolve it.

    But I got a new problem. I found the error message in /var/log/apache2/error.log:
    [Sat May 09 22:27:58 2009] [notice] caught SIGTERM, shutting down
    [Sat May 09 22:27:59 2009] [notice] Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch configured -- resuming normal operations

    -------------------------------------------------------------
    PS:
    /etc/apache2/sites-available/default:
    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName zhanjh.com
    DocumentRoot /var/www
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>
    ....
    </VirtualHost>

    /etc/hosts:
    127.0.0.1 zhanjh.com localhost.localdomain localhost
    127.0.1.1 zhanjh.com

    /etc/hostname:
    zhanjh.com
    How I took some replies it should be this but I might be misunderstanding them as well

    Code:
    ServerName zhanjh.com
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
        ....
    </VirtualHost>

  7. #7
    Join Date
    Jul 2007
    Beans
    20
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to set ServerName in Apache2?

    I hope you've all resolved this by now, but for the sake of reference, those last two messages referred to, are *notices*.

    They tell that the server has been restarted.

  8. #8
    Join Date
    Nov 2006
    Beans
    3

    Smile Re: How to set ServerName in Apache2?

    All I had to do was update hosts and the Virtual host entry and default. Thanks for all the info.

    br

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •