Installation

Configuration of WeBWorK 2.19 on Ubuntu 22.04

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
Number of replies: 21

It does look like the webwork2 app is up and running.  However, clearly the proxy to http://127.0.0.1:8080 is not working.  This is probably some issue with the apache2 configuration.  Have you enabled the apache2 modules that are needed?  In the installation manual the command given to do this is "sudo a2enmod proxy proxy_http headers".

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Yes, I have already enabled the apache2 modules.

I attached a screenshot if it can be of any help to reach the solution.

Attachment Capture.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

Your screen shot shows something that should never happen.  I don't know how it could happen with the instructions in the installation manual.  You are showing a directory listing of the webwork2 directory served via apache2.  That would only happen if the location where the webwork2 files are is being directly served by apache2 which should not be the case.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
So, what do you advise? Should I redo the configuration from scratch one more time? I would really appreciate your feedback.

Thanks

In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

I don't know that you need to redo the configuration from scratch.  We just need to figure out what is set up incorrectly.

Where are the webwork2 and pg files located?  Are they in /opt/webwork?  In other words, do you have /opt/webwork/webwork2 and /opt/webwork/pg?

What do you have in your apache2 conf file for the site (this is usually located in /etc/apache2/sites-available)?  In particular what is DocumentRoot set to?  There may be multiple site configurations to check for this.  Probably also look in the /etc/apache2/apache2.conf file.

Is there a link named /etc/apache2/conf-enabled/webwork2.conf that points to /opt/webwork/webwork2/conf/webwork2/apache2.4.conf? Also, does that file have a DocumentRoot setting (it shouldn't).

Is there a link in /var/www/html that points to /opt/webwork or /opt/webwork/webwork2.  If so that should be deleted.

The point is that there should be no way to view the webwork2 source code files in the browser as your screenshot shows.  That indicates some oddity in your apache2 configuration that might lead to the real problem.


In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Yeah, the webwork2 and pg files are located in /opt/webwork.


Upon running, /etc/apache2/sites-available$ ls

I get: 000-default.conf  default-ssl.conf  webwork.conf  webwork.conf.save


Upon running, /etc/apache2$ ls

I get:

apache2.conf      conf-enabled  mods-available  sites-available

apache2.conf.bak  envvars       mods-enabled    sites-enabled

conf-available    magic         ports.conf


Upon running, /etc/apache2/conf-enabled$ ls

I get:

charset.conf                other-vhosts-access-log.conf  webwork2.conf

javascript-common.conf      security.conf

localized-error-pages.conf  serve-cgi-bin.conf


And upon running, /opt/webwork/webwork2/conf/webwork2.apache2.4.conf


I got the file with contents as attached in the picture. And there is no DocumentRoot directive present.


Upon running /var/www/html$ ls -l

I found:

-rwxr-xr-x  1 www-data www-data   286 Feb  4 17:40 favicon.ico

-rwxr-xr-x  1 www-data www-data 10671 Jan 31 21:09 index.html

-rwxr-xr-x  1 www-data www-data   615 Feb 12 22:41 index.nginx-debian.html

drwxr-xr-x  6 root     root      4096 Feb 12 23:41 simple-app

drwxr-xr-x 22 root     root      4096 Feb 12 23:54 webwork

drwxr-xr-x 17 root     root      4096 Feb 13 00:08 webwork2


And so I removed both webwork and webwork2. Also, the other simple-app that I put while trying to troubleshoot to see if the server can connect to it which it does. So after removing them, I restarted the apache2, and I still am getting "page not found". However, I feel that a simple change can make it work, but I don't know exactly what change to make. Do you think there might be a setting adjustment needed in the AWS instance?

Attachment webwork2_apache2.4.conf.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
Your directory listing of the contents of /var/www/html shows a certain problem. The directory /var/www/html/webwork2 should not exist. That will cause a conflict with the apache2 configuration. You site configuration (probably /etc/apache2/sites-available/default-ssl.conf) probably has "DocumentRoot /var/www/html" (as it should). So if that directory exists then trying to open the URL /webwork2 on the server will open that directory instead of proxying to the webwork2 app as specified in the webwork2.apache2.4.conf file.

I also see that you have webwork.conf and webwork.conf.save files in /etc/apache2/sites-available. Those shouldn't be there. Although that shouldn't cause a problem as long as they aren't linked to in /etc/apache2/sites-enabled.
In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

I have already removed webwork2 from the listing as I mentioned in the previous chat. I have also removed webwork.conf webwork.conf.save files from /etc/apache2/sites-available.

And now, I am back to the very first issue: I am getting a 503-service unavailable error, as you can see from the attached picture.

Attachment Service-Unavailable.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

I apologize.  I missed your comment about removing the webwork and webwork2 directories from /var/www/html.

I am a little bit at a loss as to what is going on.  So I am going to try another approach to troubleshooting this.

First edit the /opt/webwork/webwork2/conf/webwork2.mojolicious.yml file and change "enabled: 0" to "enabled: 1" in the "debug" section near the end of the file.

Next stop the webwork2 service (with sudo systemctl stop webwork2).

Now from the terminal run the following:

cd /opt/webwork/webwork2
sudo mkdir /run/webwork2
sudo chown www-data /run/webwork2
sudo -u www-data hypnotoad -f bin/webwork2

That should start the hypnotoad server in the foreground and it will say "Web application available at http://127.0.0.1:8080".  If that doesn't work, then let me know what it says.

Then try to access webwork2 in the browser.  Watch the terminal.  If the webwork2 app gets anything you will see extensive debugging output in the terminal.  If you don't see anything, then the issue is the apache2 configuration.  So we need to look deeper into that.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Hi, 


No worries, I thought so too.


So, as you suggested, I edited the /opt/webwork/webwork2/conf/webwork2.mojolicious.yml file, stopped the Webwork2 service, and ran the commands you wrote. I then got an output that says, "Web application available at http://127.0.0.1:8080." However, upon trying to access Webwork2 from the browser, I got a page not found error, as you can see from the attached picture. So, the error changed from 503: Service unavailable to a page not found error.

Attachment Page not found.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

When you do that, what does the terminal show?  That looks like the request is getting to the webwork2 app, and so the terminal should show debugging information.

In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Danny Glin -
I want to confirm that we're in the same state we were earlier:
  • "sudo systemctl status webwork2" should show the service as "active (running)"
  • When you visit the page that gives the 503 error you are once again seeing the same proxy errors you posted earlier in the apache error log.

One thing I notice is that the webwork2 service is showing that it can't open the PID file, but it looks like the service is running despite this.

On your server what do you get if you run "curl http://localhost:8080/webwork2" on the server?  You should see the HTML source of the WeBWorK landing page.


In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

When I run "systemctl status webwork" I also see "webwork2.service: Can't open PID file /run/webwork2/webwork2.pid (yet?) after start: No such file or directory".  The "yet?" in that is what is happening though.  That is just a timing thing.  When the systemctl job first starts the directory doesn't exist, but it does get created and the service still starts.  As long as the last line that reads "Started webwork2.service - webwork2" is there the service is still up and running.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

When running "systemctl status webwork", it is showing me "inactive" as you can see from the below attached picture.

Attachment status - webwork.PNG
In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
So after following the above instruction, the below is what I got upon running "curl http://localhost:8080/webwork2" on the server.

Attachment Curl.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
What do you have set for the "listen:" setting in the "hypnotoad:" section of conf/webwork2.mojolicious.yml?
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Danny Glin -
Try the following:
  • Run the commands that Glenn posted in one terminal window.  Leave it open and running.
  • In another terminal window run the curl command that I suggested.

You should see some information in both terminal windows.

In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
Showing "inactive" when checking the status of the webwork in one terminal (GitBash). Hence, the curl command is also showing me that it can't connect to the server: "Failed to connect to localhost port 8080 after 0 ms: Couldn't connect to server" [from the server terminal, CloudShell].
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

If you ran "hypnotoad -f bin/webwork2" from the /opt/webwork/webwork2 directory and "curl http://localhost:8080/webwork2" run from the server in another terminal window cannot connect, then the app isn't running.  Check the terminal where you ran "hypnotoad -f /bin/webwork2".  If the app is running, then there should be no command prompt to work from and it should show "Web application available at http://127.0.0.1:8080" with a cursor blinking below it.

Note that while you are doing the above testing you should make sure that the webwork2 systemd service is NOT running as that will conflict.  So make sure you have run "sudo systemctl stop webwork2".

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

The app is running from the terminal: after running "hypnotoad -f /bin/webwork2", it brings "Web application available at http://127.0.0.1:8080" with a cursor blinking below it. However, upon running "curl http://localhost:8080/webwork2" from the server terminal, it brings the error, "curl: (7) Failed to connect to localhost port 8080 after 0 ms: Couldn't connect to server". 



In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
I am pretty much at a complete loss here. The only thing that I can think of is that the two terminal instances you are using are not actually both on the same server. If the app is running, then you would always be able to connect to it if you are on another terminal on the same computer. Unless you have some other really odd setup that is blocking it. Do you have a firewall set to block connections from the same computer?