Apache virtual host configuration error

25,183

Solution 1

The problem looks like it is with the way you've opened the section: the ending tag that matches <VirtualHost: ...> is </VirtualHost:>, as the error indicates.

Presumably you meant to open the section with the following instead:

<VirtualHost *:80>

(note that there is no colon after VirtualHost)

Solution 2

Assuming this is a web server, your current structure and configuration would look more like this:

<VirtualHost: *:80>
      ServerName       domain.tld
      ServerAlias      sub.domain.tld
      DocumentRoot     /path/to/document/root
      WSGIScriptAlias  /var/django/gpx/wsgi/mainapp.wsgi
</VirtualHost>
Share:
25,183

Related videos on Youtube

F.C.
Author by

F.C.

-.-

Updated on September 18, 2022

Comments

  • F.C.
    F.C. over 1 year

    I'm trying to configure Apache2 with Django and mod_wsgi on a virtual host.

    I wrote a simple configuration file:

    <VirtualHost: *.80>
    
            ServerName gpx
            ServerAlias gpx.gpsfte
            DocumentRoot /var/www/gpx/htdocs
    
            WSGIScriptAlias / /var/django/gpx/wsgi/mainapp.wsgi
    
    </VirtualHost>
    

    But when I reload Apache I get this error:

    # service apache2 reload
    apache2: Syntax error on line 237 of /etc/apache2/apache2.conf: Syntax error on line 9 of /etc/apache2/sites-enabled/gpx: Expected </VirtualHost:> but saw </VirtualHost>
    Action 'configtest' failed.
    The Apache error log may have more information.
       ...fail!
    

    I'm really lost, what does it mean with </VirtualHost:>? Thanks for any help you can give me.

    • rwc
      rwc almost 12 years
      Which line is 237 in your apache2.conf?
    • lava
      lava over 2 years
      copy paste the code in vim editor may missing <virtualhost >tag check it