Find the answer to your Linux question:
Results 1 to 10 of 10
Hi i have a Linux based server and am having trouble with my Apache webserver. When i try to start it i get the message: Syntax error on line 297 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! Nickair's Avatar
    Join Date
    Oct 2008
    Posts
    49

    Apache Syntax Errors


    Hi i have a Linux based server and am having trouble with my Apache webserver. When i try to start it i get the message:
    Syntax error on line 297 of /etc/httpd/conf/httpd.conf:
    ServerName takes one argument, The hostname and port of the server

    Now i am new to this whole server thing so can anyone tell me what i need to do to fix this error?

  2. #2
    Just Joined!
    Join Date
    Oct 2008
    Posts
    31
    yea you have a syntax error on line 297...

    Run the following command and the output here.

    Code:
    cat /etc/httpd/conf/httpd.conf | grep -i ServerName
    here is what the default looks like:

    Code:
    $ grep -i "servername" /etc/httpd/httpd.conf
    # ServerName gives the name and port that the server uses to identify itself.
    #ServerName www.example.com:80
    So take out the '#' symbol and change it to your domain name and used port number. While maintaining the same syntax used above. That should resolve your issue. Oh and make sure you restart the httpd deamon after editing httpd.conf!

    Code:
     killall httpd && apachectl start

  3. #3
    Just Joined! Nickair's Avatar
    Join Date
    Oct 2008
    Posts
    49
    Ok now it is giving me:

    Syntax error on line 303 of /etc/httpd/conf/httpd.conf:
    ServerName takes one argument, The hostname and port of the server

    so do i do the same thing?

  4. #4
    Just Joined! Nickair's Avatar
    Join Date
    Oct 2008
    Posts
    49
    I ran the code mentioned above "cat /etc/httpd/conf/httpd.conf grep - i ServerName"

    and got:

    # ServerName gives the name and port that the server uses to identify itself.
    ServerName MaST Server
    # ServerName directive.
    # Allow server status reports, with the URL of http://servername/server-status
    # http://servername/server-info (requires that mod_info.c be loaded).

    Now what?

  5. #5
    Just Joined!
    Join Date
    Oct 2008
    Posts
    31
    Now what?... Correct your syntax errors.

    Quote Originally Posted by Nickair View Post
    # ServerName gives the name and port that the server uses to identify itself.
    ServerName MaST Server

    That's your problem.

    The ServerName directive takes one argument, The hostname and port of the server.

    example:
    Code:
    ServerName www.google.com:80
    "MaST Server" is not valid syntax for the ServerName directive which is what you used.


    I promise Linux and Apache both get easier and funner over time.

    Good luck!

  6. #6
    Just Joined! Nickair's Avatar
    Join Date
    Oct 2008
    Posts
    49
    that is my server name "MaST Server", but since the format is "ServerName", do i insert it as "MaSTServer" instead?

    Or do i run the code

    MaSTServer www.mastweb.org:80 ?

  7. #7
    Just Joined!
    Join Date
    Oct 2008
    Posts
    31
    heh, well the good news is:

    root@posix:/# whois mastserver.org
    NOT FOUND


    So you could do that but you need to register that domain with a registrar, which will cost a small yearly fee. Than you would need to set up the appropriate DNS records on the authoritative DNS server for your domain.

    Good news is... If you do not have a registered domain you could still set up a local Apache/DNS server and run a webpage that can only be accessed on you home network.

    or...

    You could get a free hostname on a pregistered domain for free from DynDNS: DNS Hosting, Email Delivery and Other Services or No-IP - Dynamic DNS, Static DNS for Your Dynamic IP... which is free and easier... All you have to do is map the DNS A record (aka your free hostname) to your IP address on the dyndns or noip website. If you have a static IP from your ISP than that job is easy however if you have a dynamic IP it gets a little harder.

    If you have a dynamic IP address you will need to compile the NoIP client source code and make an entry in your /etc/rc.local file so the client will be restarted automaticly as a system process at boot time.

    Far less difficult than it sounds maybe... It would definately be a good learning process for a beginner to the world of internet, DNS, HTTP, and Linux.

    PS. This post is too long for me to proof read. So my apologies for any spelling errors...

    Good Luck : )

  8. #8
    Just Joined! Nickair's Avatar
    Join Date
    Oct 2008
    Posts
    49
    i have already purchased www.mastweb.org domain and i have a static IP also.

  9. #9
    Just Joined! Nickair's Avatar
    Join Date
    Oct 2008
    Posts
    49
    You know what i fixed it! I didn't know that the "ServerName" is your domain name! if i knew that i would have had this fixed days ago.. Your last post helped me realize this thanks so much!

  10. #10
    Just Joined!
    Join Date
    Oct 2008
    Posts
    31
    No problem

    Have fun!!!


    Want another cool Apache Webserver project to play with? My favorite thing about Apache is vhosts.

    Have multiple domains route to the same server (and same IP address) but based on the domain name that the person requests Apache will route them to a specified directory in the webserver... Very cool and pretty easy to set up.

Posting Permissions

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