anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
229 stars 75 forks source link

scalar SSL settings - mixed content issue on scalar site #67

Closed pguerr061703 closed 7 years ago

pguerr061703 commented 7 years ago

I am trying to get scalar to work on SSL

Is there something wrong with my configuration? The server listens on 80 and my router does the SSL offloading from 443 to 80

Getting MIXED CONTENT. Any way to fix this ?? Here is a snippet of my system/application/config/config.php

$config['is_https'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false; $config['base_url'] = 'http'.(($config['is_https']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].str_replace('//','/',dirname($_SERVER['SCRIPT_NAME']).'/');

$config['base_url'] = 'http://scalar.mysite.edu'; $config['base_url'] .= preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])).'/';

image

craigdietrich commented 7 years ago

Hi!

Right off the bat it looks like PHP's "short tags" aren't turned on, in the screengrab. This would explain why you're getting PHP in the output, instead of the rendered HTML page. See https://github.com/anvc/scalar/issues/4.

CodeIgniter (our underlying framework) is supposed to jump in if short tags aren't turned on, but for some reason that feature doesn't work.

Let me know how this goes? Craig

pguerr061703 commented 7 years ago

It works. THANK YOU...however. But I cannot log in or register. It keeps telling me invalid email or I didn't accept terms of service (which I did)...Where is the LOG file for scalar?? My install directory is /var/www/html/scalar I need to see the logs to see why I cannot log in or REGISTER as a NEW USER

craigdietrich commented 7 years ago

What happens when you try to register? The page reloads with the error message in red at the top?

Seems like maybe the database isn't hooked up correctly.

Open up "codeigniter.php" in the root folder and change "production" to "development" .. this will turn on PHP errors, which might help.

Otherwise, the log level is kept in system/application/config/config.php ... try bumping it up to 2 or 3 .. then it should save to system/application/logs

pguerr061703 commented 7 years ago

When I try to register, it says invalid userid or password? Why would it say that when I am REGISTERING an account for the 1st TIME?

image

pguerr061703 commented 7 years ago

I found the problem, the username and password for the database(called 'scalar')has been changed. I am no longer using the username in mysql called 'scalar' ....using 'scalar_myadmin' Where is the config file to update the username for the database ?

pguerr061703 commented 7 years ago

OK..now I'm getting email address already in use (when I try to register a NEW student) ...I increased the logs and this is what it says How do I fix this ??

ERROR - 2017-05-10 13:55:30 --> Severity: Warning --> date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. /var/www/html/scalar/system/application/arc/ARC2.php 12

pguerr061703 commented 7 years ago

What type of encrpytion is the password for scalar_db_users? Trying to reset my password in scalar using mysql but its not working

mysql> UPDATE scalar_db_users SET password=PASSWORD('newpassword') WHERE user_id=1;

craigdietrich commented 7 years ago

The database config is kept in system/application/config/database.php. Did you not use this file when you installed Scalar?

Simply delete the value of the password in MySQL if you want to reset it; Scalar will ask you for a new one the next time you log in.

You can ignore the timezone warning... it's just a warning.

pguerr061703 commented 7 years ago

Since I never received my email password(during a reset), I want to change my password in scalar_db_users table but its not working

Is this the command ?? mysql> UPDATE scalar_db_users SET password=PASSWORD('newpassword') WHERE user_id=1;

craigdietrich commented 7 years ago

Right, so, per my previous message, set the password to empty ("") .... that will invoke Scalar to prompt you to create a new password the next time you login. So something like,

UPDATE scalar_db_users SET password='' WHERE user_id=1;

While you're at it, you can make yourself an admin,

UPDATE scalar_db_users SET is_super=1 WHERE user_id=1;

You installed your own Scalar install, correct? If you didn't set up the email settings correctly (or at all) in local_settings.php, then Scalar wouldn't be able to email you the password change notification....

pguerr061703 commented 7 years ago

I reset my user password in mysql (made it empty using the commands below) but I still cannot get in. UPDATE scalar_db_users SET password='' WHERE user_id=1; It keeps saying the password for this account has been reset. Check email. Since my smtp settings are off, i never got the email.. image

craigdietrich commented 7 years ago

Run this and try again?

UPDATE scalar_db_users SET reset_string=NULL WHERE user_id=1;

(But leave the password empty when you log in, since you reset it to empty.)

pguerr061703 commented 7 years ago

THANK YOU!!! THAT WORKED!! YOU ARE THE BEST! To recap on the changes for SSL 1) enable short_open_tag in /etc/php.ini short_open_tag = On 2) change config.php as such (since my router is doing ssl offloading, scalar server listens on 80 --Netscalar does SSL offload to 443) $config['is_https'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false; */

/ $config['base_url'] = 'http'.(($config['is_https']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].str_replace('//','/',dirname($_SERVER['SCRIPT_NAME']).'/'); / $config['base_url'] = 'https://scalartest.mysite.edu'; $config['base_url'] .= preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])).'/'; 3) Leave .htaccess commented out since I am doing SSL offloading thru Netscaler Server listens on 80 and all SSL traffic is offloaded via Netscalar

If your server is running SSL, uncomment these lines to force all requests through https

RewriteCond %{SERVER_PORT} 80

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

THANKS!!!!!!!

craigdietrich commented 7 years ago

Great to hear! And thanks for the compliment :)