0

I have two sites site1.mydomain.com and site2.mydomain.com on a Amazon Linux 2 instance. I used a Loadbalancer and a godaddy certifcate with subdomains site1 and site2 but for cost reasons wanted to get rid of the loadbalancer and install the certifcate directly on the machine. I managed that.. but now the sites only show the Apache boilerplate page.. and not the content in my var/www/html/site1 and site2 folders. What do i have to write in the httpd.conf file or where do i have to fiddle?

I followed the instructions to install a ssl certificate on the AWSLinux2 instance.. but then it would not show my sites anymore. My godaddy certificate has all the subdomains registered.

I get for example

[ec2-user@embatek ~]$ apachectl -S
VirtualHost configuration:
*:80                   embatek.com.br (/etc/httpd/conf/httpd.conf:87)
*:433                  embatek.com.br (/etc/httpd/conf/httpd.conf:95)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48 not_used
Group: name="apache" id=48 not_used
[ec2-user@embatek ~]$ 
vidarlo
  • 6,654
  • 2
  • 18
  • 31
  • You don't show us any configuration. There's no way we can tell you whats wrong. – vidarlo Nov 17 '22 at 19:53
  • Well..I added apacheconfig -S to the file. – pierre fro Nov 17 '22 at 20:13
  • Can you show us your config? Your ***actual*** apache config files? Based on http connection to embatek.com.br you've configured TLS on port 80. – vidarlo Nov 17 '22 at 20:19
  • how would I upload the httpd.conf e ssl.conf files? – pierre fro Nov 17 '22 at 20:20
  • I have posted my ssl.config and httpd.conf files here.. I tried to paste as code.. but it looked to messy. https://www.dropbox.com/sh/vbo8bwag6jr6fuo/AACQ2HYL53nIpBgUzsOMUHnoa?dl=0 – pierre fro Nov 17 '22 at 20:33
  • [ec2-user@embatek ~]$ sudo tail /etc/httpd/logs/error_log [Thu Nov 17 20:00:58.099215 2022] [autoindex:error] [pid 3242] [client 66.249.64.226:65133] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive – pierre fro Nov 17 '22 at 21:59
  • I do not think that is really an error.. it is just that ssl serves NOT the correct /var/www/html/mysite folder.. but the parent directory /var/www/html/.. there it finds no index file and gives this error. Only in https this happens.. If i manually choose http.. it serves the right directory. this must be a standart problem in Amazon Linux 2 if you install SLL.. However in their Documentation, AWS does not mention that this could happen.. (that the https call.. goes to the main and not Virtualhost directory)... – pierre fro Nov 17 '22 at 22:02
  • :-( I know I put the question confused.. But.. nobody? Do I have to go back to using a Loadbalancer (which costs 30USD/month), because I cannot make a SSL certificate work on a Amazon Linux 2 machine? I am at the end of my ideas.. crying.. – pierre fro Nov 18 '22 at 11:17

1 Answers1

0

*:433 embatek.com.br (/etc/httpd/conf/httpd.conf:95)

This is the wrong port. The port for https is 443.

Edit line 95 of your httpd.conf to read <VirtualHost *:443> and try again.

vidarlo
  • 6,654
  • 2
  • 18
  • 31
  • I thank you SSOOOO much.. That did the trick.. Lost two workdays on this. I am a legastenic.. it seems.. 443 vs 433... what a SNAFUS.. I put the Virtualhost *:443 directive in the ssl.conf file and now all works.. – pierre fro Nov 18 '22 at 18:26
  • I missed it a first readthrough as well. But please accept the question if it solved the problem. Otherwise it will pop every now and then. – vidarlo Nov 18 '22 at 20:23
  • Hi Vidarlo, how? do I mark as solved? Just clicking on the green OK. Did that. Thanks again for your help. – pierre fro Nov 20 '22 at 10:44
  • Yup, that's it :) – vidarlo Nov 20 '22 at 11:14