Server Alias not working
synergyft.com comes up fine, but www.synergyft.com brings up the Apache test page.
By contrast, I have flywithmark.net set up on the same server (LAMP stack on CentOS7) with a virtual host, and the server alias works fine for www.flywithmark.net.
Can you look at my virtual host file and see if this looks right?
/etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
ServerAdmin mark@synergyft.com
ServerName synergyft.com
ServerAlias www.synergyft.com
DocumentRoot /var/www/html/synergyft.com/publichtml/
ErrorLog /var/www/html/synergyft.com/logs/error.log
CustomLog /var/www/html/synergyft.com/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =synergyft.com [OR]
RewriteCond %{SERVERNAME} =www.synergyft.com
RewriteRule ^ https://%{SERVERNAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerAdmin mark@synergyft.com
ServerName flywithmark.net
ServerAlias www.flywithmark.net
DocumentRoot /var/www/html/flywithmark.net/publichtml/
ErrorLog /var/www/html/flywithmark.net/logs/error.log
CustomLog /var/www/html/flywithmark.net/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =flywithmark.net [OR]
RewriteCond %{SERVERNAME} =www.flywithmark.net
RewriteRule ^ https://%{SERVERNAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerAdmin mark@synergyft.com
ServerName greatlakes.synergyft.com
ServerAlias www.greatlakes.synergyft.com
DocumentRoot /var/www/html/greatlakes.synergyft.com/publichtml/
ErrorLog /var/www/html/greatlakes.synergyft.com/logs/error.log
CustomLog /var/www/html/greatlakes.synergyft.com/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =www.greatlakes.synergyft.com [OR]
RewriteCond %{SERVERNAME} =greatlakes.synergyft.com
RewriteRule ^ https://%{SERVERNAME}%{REQUEST_URI} [END,NE,R=permanent]
Also here's the SSL virtual host file:
/etc/httpd/conf.d/vhost-le-ssl.conf
ServerAdmin mark@synergyft.com
ServerName synergyft.com
ServerAlias www.synergyft.com
DocumentRoot /var/www/html/synergyft.com/public_html/
ErrorLog /var/www/html/synergyft.com/logs/error.log
CustomLog /var/www/html/synergyft.com/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/synergyft.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/synergyft.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/synergyft.com/chain.pem
ServerAdmin mark@synergyft.com
ServerName greatlakes.synergyft.com
ServerAlias www.greatlakes.synergyft.com
DocumentRoot /var/www/html/greatlakes.synergyft.com/public_html/
ErrorLog /var/www/html/greatlakes.synergyft.com/logs/error.log
CustomLog /var/www/html/greatlakes.synergyft.com/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/synergyft.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/synergyft.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/synergyft.com/chain.pem
ServerAdmin mark@synergyft.com
ServerName flywithmark.net
ServerAlias www.flywithmark.net
DocumentRoot /var/www/html/flywithmark.net/public_html/
ErrorLog /var/www/html/flywithmark.net/logs/error.log
CustomLog /var/www/html/flywithmark.net/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/synergyft.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/synergyft.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/synergyft.com/chain.pem
4 Replies
Hello,
Just to clarify the formatting, it looks like the file should appear as the following:
/etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<virtualhost *:80="">
ServerAdmin mark@synergyft.com
ServerName synergyft.com
ServerAlias www.synergyft.com
DocumentRoot /var/www/html/synergyft.com/publichtml/
ErrorLog /var/www/html/synergyft.com/logs/error.log
CustomLog /var/www/html/synergyft.com/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =synergyft.com [OR]
RewriteCond %{SERVERNAME} =www.synergyft.com
RewriteRule ^ https://%{SERVERNAME}%{REQUEST_URI} [END,NE,R=permanent]
</virtualhost>
<virtualhost *:80="">
ServerAdmin mark@synergyft.com
ServerName flywithmark.net
ServerAlias www.flywithmark.net
DocumentRoot /var/www/html/flywithmark.net/publichtml/
ErrorLog /var/www/html/flywithmark.net/logs/error.log
CustomLog /var/www/html/flywithmark.net/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =flywithmark.net [OR]
RewriteCond %{SERVERNAME} =www.flywithmark.net
RewriteRule ^ https://%{SERVERNAME}%{REQUEST_URI} [END,NE,R=permanent]
</virtualhost>
<virtualhost *:80="">
ServerAdmin mark@synergyft.com
ServerName greatlakes.synergyft.com
ServerAlias www.greatlakes.synergyft.com
DocumentRoot /var/www/html/greatlakes.synergyft.com/publichtml/
ErrorLog /var/www/html/greatlakes.synergyft.com/logs/error.log
CustomLog /var/www/html/greatlakes.synergyft.com/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =www.greatlakes.synergyft.com [OR]
RewriteCond %{SERVERNAME} =greatlakes.synergyft.com
RewriteRule ^ https://%{SERVERNAME}%{REQUEST_URI} [END,NE,R=permanent]
</virtualhost>
Also here's the SSL virtual host file:
/etc/httpd/conf.d/vhost-le-ssl.conf
<ifmodule mod_ssl.c="">
<virtualhost *:443="">
ServerAdmin mark@synergyft.com
ServerName synergyft.com
ServerAlias www.synergyft.com
DocumentRoot /var/www/html/synergyft.com/public_html/
ErrorLog /var/www/html/synergyft.com/logs/error.log
CustomLog /var/www/html/synergyft.com/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/synergyft.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/synergyft.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/synergyft.com/chain.pem
</virtualhost>
</ifmodule>
<ifmodule mod_ssl.c="">
<virtualhost *:443="">
ServerAdmin mark@synergyft.com
ServerName greatlakes.synergyft.com
ServerAlias www.greatlakes.synergyft.com
DocumentRoot /var/www/html/greatlakes.synergyft.com/public_html/
ErrorLog /var/www/html/greatlakes.synergyft.com/logs/error.log
CustomLog /var/www/html/greatlakes.synergyft.com/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/synergyft.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/synergyft.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/synergyft.com/chain.pem
</virtualhost>
</ifmodule>
<ifmodule mod_ssl.c="">
<virtualhost *:443="">
ServerAdmin mark@synergyft.com
ServerName flywithmark.net
ServerAlias www.flywithmark.net
DocumentRoot /var/www/html/flywithmark.net/public_html/
ErrorLog /var/www/html/flywithmark.net/logs/error.log
CustomLog /var/www/html/flywithmark.net/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/synergyft.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/synergyft.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/synergyft.com/chain.pem
</virtualhost>
</ifmodule>
I can't be entirely certain exactly what this is based just on this information. What do you see when you run the command tail -n 30 /var/log/httpd/error.log
? Do you see your index file in /var/www/html/synergyft.com/public_html/
? And also just inspecting closer, I see your *:80 entry uses /var/www/html/synergyft.com/publichtml/
while your *:443 entry uses /var/www/html/synergyft.com/public_html/
. Is this accurate for how you have your system configured? Thank you in advance.
tail -n 30 /var/log/httpd/error.log
tail: cannot open ‘/var/log/httpd/error.log’ for reading: No such file or directory
And also just inspecting closer, I see your *:80 entry uses /var/www/html/synergyft.com/publichtml/ while your *:443 entry uses /var/www/html/synergyft.com/public_html/. Is this accurate for how you have your system configured? Thank you in advance.
Actually both files are set to the document root at /var/www/html/synergyft.com/public_html. For some reason when I pasted it into this ticket, it dropped the underscore, which is wierd…