Hi there, I’m running a fresh install of Ubuntu 14.04 LTS on Digitalocean. It’s a fresh installed and I have tried re-imaging a couple of times to rule out any server issues.
So basically, I have set up a virtual server “techsite.cf” in Virtualmin. DNS records are handled by Digitalocean and I have forwarded both “techsite.cf” and “www.techsite.cf” to my site’s IP address.
Now, the issue is that “www.techsite.cf” points correctly to /home/techsite/public_html, whereas techsite.cf points to /var/www/html instead. It seems that the former is following the correct VirtualHost file whereas the latter is following the “000-default.conf” VirtualHost file instead.
I am intrigued as to what could be wrong. When I unlink the 000-default.conf file, it seems to work fine, but shouldn’t the non-www and www work out of the box?
Here is 000-default.conf and techsite.cf.conf respectively:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80>
SuexecUserGroup "#1000" "#1000"
ServerName techsite.cf
ServerAlias www.techsite.cf
ServerAlias webmail.techsite.cf
ServerAlias admin.techsite.cf
DocumentRoot /home/techsite/public_html
ErrorLog /var/log/virtualmin/techsite.cf_error_log
CustomLog /var/log/virtualmin/techsite.cf_access_log combined
ScriptAlias /cgi-bin/ /home/techsite/cgi-bin/
ScriptAlias /awstats/ /home/techsite/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/techsite/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/techsite/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/techsite/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/techsite/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.techsite.cf
RewriteRule ^(.*) https://techsite.cf:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.techsite.cf
RewriteRule ^(.*) https://techsite.cf:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "techsite.cf statistics"
AuthType Basic
AuthUserFile /home/techsite/.awstats-htpasswd
require valid-user
</Files>
</VirtualHost>
Any help would be greatly appreciated!