0

I have CentOS 8 I installed LAMP, Varnish, etc.

I setup hosts

/etc/hosts

ip site1.com www.site1.com ip site2.com www.site2.com

I setup Apache like this:

/etc/httpd.conf to include sites-enabled/ I have sites-enabled and sites-available with two configurations, site1.com.conf and site2.com.conf

Here what I included in etc/httpd/conf/httpd.conf

IncludeOptional sites-enabled/*.conf

Still it is not working. Any idea how to fix this?

I have sites-enabled and sites-available with this *.conf:

<VirtualHost *:8080>
    ServerName ip
Redirect / 301 external_site
</VirtualHost>

and 

<VirtualHost *:8080>
    ServerName site2.com
    ServerAlias www.site2.com
    DocumentRoot /var/www/site2.com/html
    ErrorLog /var/www/site2.com/html/log/error.log
    CustomLog /var/www/site2.com/html/log/requests.log combined
</VirtualHost>

I manage to get this to work now but the https versions are not working, how to fix the https versions ?

I generate 2 ceritficates using mod_ssl

I put 1 of them in /etc/httpd/conf.d/httpd.conf ...

Fixed: Problem was misconfiguration of /etc/httpd/conf.d/ssl.conf

Wed
  • 15
  • 9
  • The first `ServerName` should be `ServerName site1.com`. You should not mix IP-based and [Name-based](https://httpd.apache.org/docs/2.4/vhosts/name-based.html) virtual hosts. `site1.com` is displaying correctly just because its config file is alphabetically before `site2.com`. For the SSL virtual hosts, you should just add the `SSLEngine on` and the [SSLCertificate*](https://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatechainfile) directives. – Piotr P. Karwasz Jan 29 '20 at 20:06
  • yes i fixed how show be instead of servername ip since i dont have a domain pointing to the server ? – Wed Jan 29 '20 at 20:16
  • Yes, but you did override `DNS` putting the two lines in `/etc/hosts`. For local usage that is enough. – Piotr P. Karwasz Jan 29 '20 at 20:22

0 Answers0