Strange behavior of Apache. Virtual hosts?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
49 views
You have a server (debian, there is a panel ISPConfig 3) with Apache. Create a virtual host trail. follows:

$ cat /etc/apache2/sites-enabled/example.com.vhost 
<Directory /var/www/example.com>
AllowOverride None
Order Deny,Allow
Deny from all





DocumentRoot /var/www/example.com/web


ServerName example.com

ServerAlias www.example.com

ServerAdmin webmaster@example.com
...


Actually www.example.com properly open and if you enter example.com (without www), it opens the contents of the default virtual host.

Here's the contents:

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

DirectoryIndex index.php index.htm index.html

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None




Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

...


What could be the problem?
by | 49 views

7 Answers

0 like 0 dislike
Try to add some default ServerName for virtual host. From the documentation:
\r
If no ServerName is specified, then the server attempts to deduce the hostname by performing a reverse lookup on the IP address.
by
0 like 0 dislike
DNS there may not have been involved?
by
0 like 0 dislike
nothing suspicious,
suspiciously only that with example.org this is not a problem — comes with www and without. The configs of the virtual hosts are exactly the same. But CSN wasn't here exactly)
by
0 like 0 dislike
I was on another VDS with the ISP Manager. He wrote some hosts are not in sites-enabled as necessary, and at the end of apache2.conf (or httpd.conf) which broke the subdomains.
by
0 like 0 dislike
check whether all letters in the alias written in English
usually, if inexplicable problem, then there was made unnecessary movement.
by
0 like 0 dislike
When I have, it seems, everything has to work and not work, then I create a new entity and it usually works(create a virtual host on test.com), and then gradually, line by line, turn test.com in example.com checking for correctness at each iteration. Thus almost you can solve almost any problem, if you're stumped.
by
0 like 0 dislike
Apache was restarted after the changes?
by

Related questions

0 like 0 dislike
1 answer
asked May 22, 2019 by makarovpro
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
asked Mar 26, 2019 by hps
110,608 questions
257,186 answers
0 comments
28,100 users