drlippman / IMathAS

IMathAS Online Math Assessment
Other
115 stars 99 forks source link

404 error with Ubuntu server #250

Closed enoxos closed 3 years ago

enoxos commented 3 years ago

I just installed iMathAS in Ubuntu Server 20.04 and after installation and configuration, I can log into server, create courses, users, and assignments. However, some links are not working properly, namely the Course Settings, Select Libraries under assignment management, or the More link under Tools, among others. The Google Chrome developer tools point the issue into some JavaScript files under the javascript folder, but the files are present. Here is the error message from Google Chrome developer tools: Failed to load resource: the server responded with a status of 404 (Not Found). The resources not linked properly (according to Google Chrome) are: general.js:1, ASCIIsvg_min.js:1,course.js:1 to name a few.

I was wondering if I am doing something wrong (more likely) with the server setup or if there is some issue with the iMathAS code. Thank you

drlippman commented 3 years ago

I'm afraid I have no idea why this would be happening. The only thing I can think of is to check that your $imasroot is set correctly in your config.php.

enoxos commented 3 years ago

Thanks for the reply! I checked the imathas root directory in the config.php file, but everything looks fine. I am guessing if the root directory was not set properly, the whole site would probably not be accessible which is not the case. Additionally, the file and folder permissions are set properly since all other resources in other folders are accessible except the javascript folder. I am now leaning toward a conflict between the imathas javascript resources and some Ubuntu server package which can be a nightmare to track down. I was thinking to rename the imathas javascript, but I am guessing there are 100's of dependencies that need to also be modified accordingly which is an even bigger nightmare. Will play around a bit more and if no solution is found, will probably switch to another Linux distribution for testing. Any advise on Linux distributions that have been tested and worked? Thank you

drlippman commented 3 years ago

I'm pretty sure I've used ubuntu before without problems. Try doing view-source on the page with the loading errors, and look for the script tags that load them. Confirm the URLs look right. Try putting the URL directly in the browser and see if it's able to load it.

MathTV commented 3 years ago

I had a similar problem detailed in this old ticket:

https://github.com/drlippman/IMathAS/issues/141

Make sure the root starts with a slash:

$imasroot = "/imathas";

Or, if imathas is not in a subdirectory:

$imasroot = "";

ingodahn commented 3 years ago

My development server runs IMathAS on Ubuntu 20.04.2 LTS. In case of update problems, before debugging, I run the following steps to maintain the integrity of the application - each of them has already prevented a problem: run 'php upgrade.php' in the IMathAS root folder run 'npm run build' in assess2/vue-src Restart Apache ID

enoxos commented 3 years ago

I finally solved the issue! The javascript-common package, which was probably installed with apache2, generates a symbolic link in its configuration file javascript-common.conf.

Consequently, an apache (global) alias is created in usr/share/javascript which is a far too common name.

As such, the webserver is looking into the imathas javascript files in the /usr/share/javascript folder instead of the /imathas/javascript folder.

The exact behavior would be that the imathas site works fine unless you click on a link that requires a javascript file in which case nothing happens.

The first hint as mentioned above was the Google Chrome developer tools were thrown several Failed to load resource: the server responded with a status of 404 (Not Found) all pointing for resources in the javascript folder.

My action: disable javascript-common package: a2disconf javascript-common

I have not seen any issues by disabling the package as of yet, but the imathas server is working fine now.

It may be wise to rename the javascript folder of the imathas to avoid future such conflicts.

Thank you all.

enoxos commented 3 years ago

I wanted to give a small update on this issue just in case someone finds it useful: I created a new virtual machine with Ubuntu server 20.04 and went though the whole installation of imathas. The installation was successful and no 404 errors even-though apache2 was installed and the two virtual machines were almost identical.

So the package javascript-common was probably NOT installed along with apache2, on the first virtual machine that produced the 404 errors. I am really not sure how the package got implicitly installed, but after disabling it, the 404 errors are gone.

enoxos commented 3 years ago

Further update: I found out the javascript-common was installed with the npm package which may be part of node.js or separate depending your machine or the installation procedure of node.js.

Node.js and npm are needed for the extra livepoll imathas feature so if you are only doing the basic installation you will probably not encounter the 404 issue above.