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, eg /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 xyz@blubber.de
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!
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>
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.