ElkArte Community

Project Support => General ElkArte discussions => Topic started by: badmonkey on July 10, 2016, 06:26:12 pm

Title: Going https
Post by: badmonkey on July 10, 2016, 06:26:12 pm
Hey gang!  Interested in venturing into new territory here.  Reading through the other ssl thread here got me considering the possibility.   In this case the cert would be for multiple domains on a Centos 6 CPanel VPS .  Now, for the ssl cert stupid, could someone explain the process in detail?  What is the easiest way to install on said server?  Can this be done through CPanel? Cheap (free?) is desired.  Thanks!
Title: Re: Going https
Post by: meetdilip on July 11, 2016, 12:42:43 am
There is a Let's Encrypt plugin for cPanel. See if you can learn more about it. May be, through your hosting provider.

https://forums.cpanel.net/threads/how-to-installing-ssl-from-lets-encrypt.513621/
Title: Re: Going https
Post by: badmonkey on July 11, 2016, 04:30:57 pm
Here is a tidbit.  It's a cpanel plugin.  Super easy installation.  It works like a charm too. 

https://github.com/Prajithp/letsencrypt-cpanel

It doesn't get any easier than that!
Title: Re: Going https
Post by: badmonkey on July 11, 2016, 11:45:38 pm
Got this up and running on a few sites.  Works swell for the most part.  After the certificate is installed, all url settings in the Admin panel need updating.  Things such as avatar urls, smileys, themes, etc.  

One site has a different issue.  This site is an inherited one.  The former owner edited the $scripturl in Querystring.php, replacing /index.php with /content.  URLs have a much nicer appearance.  However, the SSL URLs don't want to see the /content portion.  Anyone know what can be done?  htaccess rewrite rule?  Admittedly that is not a strong suit.  
Title: Re: Going https
Post by: ahrasis on July 12, 2016, 06:41:50 am
It would be hard to guess. Temporarily, just backup that file and restore default in its place.
Title: Re: Going https
Post by: badmonkey on July 12, 2016, 05:12:45 pm
Perhaps that was a poor explanation.  Using http://www.mysite.com/content resolves just fine.  Using https://www.mysite.com/content gives 404 errors.  However, https://www.mysite.com will resolve to the index fine.  Anyone know how to fix it?
Title: Re: Going https
Post by: ahrasis on July 13, 2016, 10:11:19 pm
Have you fixed all the urls to https? If you did, you need to go through your Querystring.php file and file all modifications made to it. May be it had specified the forum to use http instead while changing index.php to /content/.

Alternatively, you may try to force elkarte to change all its url from non-ssl to ssl[1]as follows:

Code: [Select]
		$mesfa = array();
// SSL and non SSL url fixes in others
$url_nossl = 'http://' . $_SERVER['SERVER_NAME'];
$url_ssl = 'https://' . $_SERVER['SERVER_NAME'];
if (empty($_SERVER['HTTPS'])) {
$mesfa[$url_ssl] = $url_nossl;
} else {
$mesfa[$url_nossl] = $url_ssl;
} // Now let's change necessary things
return str_replace(array_keys($mesfa), array_values($mesfa), $buffer);

This can be made into a simple fully hook addon calling your(&$buffer) function.
I have tested this code in the latest version of MESFA addon
Title: Re: Going https
Post by: badmonkey on July 13, 2016, 10:22:38 pm
Thanks!  I will try this tomorrow.