Link to home
Start Free TrialLog in
Avatar of msidnam
msidnamFlag for United States of America

asked on

Trouble with adding SSL to Apache2

I'm having a heck of a time getting SSL to work on an Ubuntu 18.04 server using Apache2. I've installed Mediawiki to /var/www/html/wiki. I have a mediawiki.conf file that has virtual host entries for both 80 and 443. I have SSLEngine on and for the certificate file and the key file I have them pointed to the correct directory.

I'm having two issues:

1. If i type https://domain.com/wiki, it gives me a 404 not found, yet it fills in the /index.php/Main_Page at the end of the URL but the port says 80
2. If i type https://domain.com/wiki/index.php/Main_page it works and it uses 443. The issue with that is, I'm getting an error with chrome that says I'm getting mixed content. When i go to developer tools in chrome it's telling me that the .png file im using for the logo is not secure.

I haven't messed with ubuntu and apache2 for a while so i'm probably missing something, im just not sure what.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msidnam

ASKER

Using the virtual hosts file you gave me, I am no longer getting the 404 page not found errors.

If i go to http://domain.com it redirects me to http://domain.com/wiki/index.php/Main_Page.
If i try it with https it send me back to the http version.
If i put in https://domain.com/wiki/index.php/Main_page it goes right to the https site. Also, when i use IE, i dont get the error that it has mixed content.

I'm starting to think it has something to do with the way mediawiki is also forwarding/rewriting the URL. If i use the curl command you gave me and only put in the domain.com, it gives me an HTTP/1.1 200 OK. If i put domain.com/wiki I get 2 301 Moved Permanently. one to /wiki/ and the other to /wiki/index.php/Main_Page.

If I am going to http://domain.com, should it be sending me to the https://domain.com?
Avatar of msidnam

ASKER

I changed the port 80 virtual host to redirect by using the Redirect / https://domain.com/wiki/index.php/Main_Page.

Also, for some reason something is cached somewhere and it thinks my logo has a capital in the first letter. so i changed the filename on the server to have a capital for the first letter and the mixed content error went away.

as it stands, if i type http://domain.com or https://domain.com, they both go to https://domain.com.wiki/index.php/Main_Page

Thank you for the help.
Sounds like your MediaWiki config (PHP file somewhere) or database is polluted with links of the form http://domain.com which should be changed to //domain.com (no http: or https:) for protocol agnostic access.

My guess when you find where the http:// is hard coded + fix this, the rest of your problems will resolve.
When you fix your database. Be sure to refer to MediaWiki docs regards serialized data.

https://www.mediawiki.org/wiki/Manual:Serialization

Serialized data requires a special mechanism to update data. Best to ask about this in the MediaWiki forums.
Avatar of msidnam

ASKER

Thank you David for all of your help and knowledge.