Trouble Getting 2nd Vhost to work
VirtualHost configuration:
*:443 shockalarm.com (/etc/apache2/sites-enabled/shockalarm.com.conf:7)
*:80 synergyitgroup.net (/etc/apache2/sites-enabled/synergyitgroup.net.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
Here is shockalarm's conf file:
<virtualhost *:80="">ServerName shockalarm.com/
Redirect permanent / https://shockalarm.com/</virtualhost>
<ifmodule mod_ssl.c=""><virtualhost *:443="">ServerName shockalarm.com
ServerAlias www.shockalarm.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/shockalarm.com/public_html
<directory var="" www="" shockalarm.com="" public_html="">Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all</directory>
ErrorLog /var/www/shockalarm.com/logs/error.log
CustomLog /var/www/shockalarm.com/logs/access.log combined
SSLEngine On
SSLCertificateFile redacted
SSLCertificateKeyFile redacted
SSLCertificateChainFile redacted</virtualhost></ifmodule>
Here is Synergy's conf file (SSL not enabled yet)
<virtualhost *:80="">ServerName synergyitgroup.net
ServerAlias www.synergyitgroup.net
ServerAdmin webmaster@synergyitgroup.net
DocumentRoot /var/www/synergyitgroup.net/public_html
<directory var="" www="" synergyitgroup.net="" public_html="">Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order allow,deny
allow from all</directory>
ErrorLog /var/www/synergyitgroup.net/logs/error/.logs/error.log
CustomLog /var/www/synergyitgroup.net/logs/error/.logs/access.log combined</virtualhost>
Any clue as to what I'm doing wrong??? Thanks in advance for helping this rookie out!
6 Replies
<virtualhost *:80="">ServerName shockalarm.com/
ServerAlias www.shockalarm.com/
Redirect permanent / https://shockalarm.com/</virtualhost>
<virtualhost *:443=""><ifmodule mod_ssl.c="">SSLEngine On
SSLCertificateFile /etc/ssl/certs/STAR_shockalarm_com.crt
SSLCertificateKeyFile /etc/ssl/private/STAR_shockalarm.com.key
SSLCertificateChainFile /etc/ssl/certs/STAR_shockalarm_com.ca-bundle.crt
ServerName shockalarm.com/
DocumentRoot /var/www/shockalarm.com/public_html
<directory var="" www="" shockalarm.com="" public_html="">Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all</directory>
ErrorLog /var/www/shockalarm.com/logs/error.log
CustomLog /var/www/shockalarm.com/logs/access.log combined</ifmodule></virtualhost>
@mtjones:
For shockalarm's config file there's a few things that strike me as out of the ordinary. A few of them may just be formatting conventions, but could you try running the config file like this?
<virtualhost *:80="">ServerName shockalarm.com/ ServerAlias www.shockalarm.com/ Redirect permanent / https://shockalarm.com/</virtualhost> <virtualhost *:443=""><ifmodule mod_ssl.c="">SSLEngine On SSLCertificateFile /etc/ssl/certs/STAR_shockalarm_com.crt SSLCertificateKeyFile /etc/ssl/private/STAR_shockalarm.com.key SSLCertificateChainFile /etc/ssl/certs/STAR_shockalarm_com.ca-bundle.crt ServerName shockalarm.com/ DocumentRoot /var/www/shockalarm.com/public_html <directory var="" www="" shockalarm.com="" public_html="">Options Indexes FollowSymLinks MultiViews AllowOverride All Order Allow,Deny Allow from all</directory> ErrorLog /var/www/shockalarm.com/logs/error.log CustomLog /var/www/shockalarm.com/logs/access.log combined</ifmodule></virtualhost>
curl http://synergyitgroup.net
<title>301 Moved Permanently</title>
# Moved Permanently
The document has moved [here](https://shockalarm.com/).
* * *
<address>Apache/2.4.18 (Ubuntu) Server at synergyitgroup.net Port 80</address>
Are you using any CMS such as Drupal or WordPress? You may want to check any .htaccess files in the document root for
Here's the guide for changing the site URL in WordPress, just in case:
attempt to access
As previously stated you will also need to check for any redirects in your .htaccess file if present.
Another thing to check that happened to me, is the file encoding for the config files. your config files should be encoded as unix files and not dos/windows. The problem was caused by using notepad++ in windows to create the config files and then upload the files to my server via ftp. I originally didn't think about that and if I had I could have switched the files to use unix encoding in notepad++.
I was using nginx as the front end server and apache for the backend. I had 2 domains configured that was causing trouble. kb.example.org and kb.example.com. For some reason both domains were pointing to the same site example.com. After checking both sites access log files I found out that nginx was processing kb.example.com under the correct host but for some reason kb.example.org was being processed under example.com and not kb.example.org. The underlying issue for me was the file encoding. My files was using dos encoding causing nginx to parse the config files incorrectly. I had to convert the encoding to unix and restart nginx to fix the issue.