0
votes

I have a problem using the build-in apache webserver under ElCapitan.

I want to set up my Sites-Directory in my users-directory. This works fine by adding a user config and and so on. So my localhost/~Fabian gives me the content of /User/Fabian/Sites/index.php.

Now I am trying to set up virtual hosts in this directory, e.g. /User/Fabian/Sites/Projekte/testsite.me/public.

So I activated the virtualhost module and included it in my httpd.conf. After this, I set up a virtualhost in the httpd-vhost.conf:

</VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/Users/Fabian/Sites/Projekte/testsite.me/public"
    ServerName testsite.me
    ErrorLog "/Users/Fabian/Sites/Logs/testsite-error_log"
    CustomLog "/Users/Fabian/Sites/Logs/testsite-custom_log" common
</VirtualHost>

I also added the ServerAlias to my hosts file

127.0.0.1    testsite.me

Trying to open http://testsite.me shows me the default "It works"-page.

Running apachectl configtest gives me an syntax error:

httpd: Syntax error on line 499 of /private/etc/apache2/httpd.conf: Syntax error on line 74 of /private/etc/apache2/extra/httpd-vhosts.conf: </VirtualHost without matching <VirtualHost section

Line 499 in httpd.conf looks like this:

Include /private/etc/apache2/extra/httpd-vhosts.conf

Line 74ff of httpd-vhosts.conf contain the virtualhost I defined above.

Any idea how to solve this problem? What is a VirtualHost section?

Thank you!

1
The topic at Stack Overflow is programming and this question seems to have very little to do with that. I think you'd get better, and more, responses in a more suitable Stack Exchange site like Unix & Linux, Ask Different or Super User. - user2845360

1 Answers

0
votes

You start your vhost definition with </VirtualHost *:80> That should be <VirtualHost *:80> without the slash. Although the apache config files are not xml, the Syntax for starting and ending sections are the same; so you start with <tag> and end with </tag>.