Reputation: 383
I have added a new domain to Amazon linux server running apache
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain
ErrorDocument 404 /index.html
ErrorLog /var/log/mydomain.com-error_log
CustomLog /var/log/mydomain.com-access_log common
<Directory /var/www/mydomain>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>
Restarted the server
checked status
sudo systemctl restart httpd
active (running) 1 min
But for whatever reason the default apache index.html is served
Directory exists for the new domain , index.html is there chmod 644 done
Error log for the new domain is empty. Access log and error lod are empty
-rw-r--r--. 1 root root 0 Dec 21 15:26 mydomain.com-access_log
-rw-r--r--. 1 root root 0 Dec 21 09:50 mydomain.com-error_log
tail of host error_log is normal
AH00489: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1c configured -- resuming normal operations
[Mon Dec 21 15:02:24.161922 2020] [core:notice] [pid 73594:tid 140519198484800]
AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
I feel a permissions/cert problem. Or one more thing letsencrypt crt has been installed for the new domain probably successfully
[ec2-user@ip-xx-xx-xx-xx ~]$ wget mywwwdomain.com
--2020-12-21 15:57:26-- http://mywwwdomain.com/
Resolving mywwwdomain.com (mywwwdomain.com)... 55.55.55.55
Connecting to mywwwdomain.com (mywwwdomain.com)|55.55.55.55|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://mywwwdomain.com/ [following]
--2020-12-21 15:57:26-- https://mywwwdomain.com/
Connecting to mywwwdomain.com (mywwwdomain.com)|55.55.55.55|:443... connected.
ERROR: The certificate of ‘mywwwdomain.com’ is not trusted.
ERROR: The certificate of ‘mywwwdomain.com’ hasn't got a known issuer.
The certificate's owner does not match hostname ‘mywwwdomain.com’
[ec2-user@ip-xx-xx-xx-xx ~]$
55.55.55.55 - my IP address
How to debug further and fix this?
Upvotes: 1
Views: 1838
Reputation: 809
If you added a new domain in a new file, make sure the new file is properly included in the main httpd config file.
You can get a list of the VHs apache is serving issuing the following command:
# apache2ctl -S
(On Debian/Ubuntu), # apachectl -S
(On CentOS/RHEL) or
# httpd -S
.
Upvotes: 1