Quick Configuration Guide

48 views
Skip to first unread message

Nathan Ruffing

unread,
Dec 15, 2024, 6:41:47 AM12/15/24
to modwsgi
I think I completed the quick configuration guide, but the result was the apache2 default page, not "Hello World." Sooo, am I incomplete or did I do something wrong?

Honestly I'm not really even sure I actually completed the quick configuraiton guide because it's not clear what it's saying TO DO and what the scope of the configuration guide is. I read along and I see the sample configuration text and I copy-pasted that into the apache2.conf file and replaced text per my situation, but does that mean I should see "Hello World"? OR do I have to do the typical apache2 a2ensite command still? Is the configuration everything or is there other poining and enabling to be done?

The word "mount" is not helpful because it's still not clear if WSGI is the application or points to the application, so does "mounted" mean complete or halfway complete? "Would be a good configuration" is also not helpful. "Do exactly this" is what I am looking for in a "guide."

It would be nice to have one specific, COMPLETE instruction on how to get the "Hello World" message, then AFTER THAT describe what the parts of WSGI are. Seems like the confusing descriptions come before anything works and I'm left here wondering what is even supposed to happen or how complete the guide is supposed to be. Did I complete the steps or not? I guess I should say the problem is: It's not clear whether I have completed the steps and should TROUBLESHOOT, or if I have not completed all the required steps and I should seek other steps I missed?

I appreciate what I think mod_wsgi is supposed to do, but the instructions are so confusing I can't even formulate a question.

Thanks,

Graham Dumpleton

unread,
Dec 15, 2024, 6:52:08 AM12/15/24
to mod...@googlegroups.com
I can’t really help you as you have not shown how you tried to configure Apache. What mod_wsgi configuration have you used and where in the Apache configuration did you put it? What other Linux distro specific steps did you do to enable Apache and trigger it to restart or reload the configuration?

The reason the documentation doesn’t give exact steps is because how you need to do things with Apache is different for different Linux distros. It isn’t really practical to try and main docs for every Linux distro, macOS , Windows and other Unix variants.So it is assumed you have checked the Apache documentation for your operating system first to learn where you need to put any configuration and what extra steps you may need to run to enable it and/or restart Apache.

If you indicate what operating system you are using, what Apache package distribution package is being used or how you otherwise installed Apache, and how you tried to configure it then I may be able to guide you.

On 15 Dec 2024, at 8:41 PM, Nathan Ruffing <na...@rr34.us> wrote:


--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/modwsgi/ed8928d3-3ff6-4dae-8382-e229fcca79b1n%40googlegroups.com.

Nathan Ruffing

unread,
Dec 15, 2024, 3:55:28 PM12/15/24
to Graham Dumpleton, mod...@googlegroups.com
I really appreciate the response. Maybe the answer to this question would tell me what I need to know.


If I get that simple Hello World application working, then I want to replace the Hello World application with my application, where do my app files go?? Do I put all the files there in the recommended directory and rename my 'main.py' file 'main.wsgi'?

What is .wsgi? It looks like Python, so why isn't it .py like all the other Python?

I'm sorry I really don't ask questions that much. Most answers are already available and I'm sure mine is too, but in this case I don't really even know which question is my question if that makes sense.

Nathan Ruffing

Nathan Ruffing

unread,
Dec 15, 2024, 4:03:51 PM12/15/24
to Graham Dumpleton, mod...@googlegroups.com
Is a server required AT ALL? Does the WSGI stand alone as a server without Apache or nginx?

Is mod_WSGI a server? Or does it act as a go-between between the app and the server?I keep reading and watching videos and the answer to that question doesn't seem clear.

Nathan Ruffing

unread,
Dec 15, 2024, 4:28:22 PM12/15/24
to Graham Dumpleton, mod...@googlegroups.com
"A very simple WSGI application, and the one which should be used for the examples in this document, is as follows:"

That excerpt from the guide really highlights my confusion. Why would I make a WSGI application? I have a Flask application and I didn't think WSGI was for making applications. I thought WSGI was for serving existing applications.

Graham Dumpleton

unread,
Dec 15, 2024, 6:38:44 PM12/15/24
to Nathan Ruffing, mod...@googlegroups.com
Yes you require Apache as mod_wsgi is an embedded module specifically for the Apache httpd server. You either manually integrate it into the system Apache installation, or you can use pip install method and use mod_wsgi-express to also run a standalone instance, although when I say standalone you are still using the system Apache installation, just that mod_wsgi-express generates a standalone configuration for you and runs the server instance on a separate port to the system Apache instance.

A .wsgi extension is used in docs rather than .py purely because some Apache installations include default configuration which maps .py extensions to CGI handler in Apache thus conflicting with mod_wsgi if you use .py. So the code is still Python, but .wsgi is shown in examples to avoid that conflict. You can use .py if you want, but you must make sure you modify the Apache configuration necessary so that .py extension is not handled as a CGI script. Because distros are different, you would need to work out how to disable the default CGI configuration if present.

Anyway as I said before, unless you explain what configuration you used, where you placed it, what distro you are using and what manual steps if any you took to enable stuff in Apache I can’t really help with your original problem easily and can only guess.

Most of the time for what you describe problem is:

1. Apache was not restarted or forced to reload configuration after changes.
2. Configuration was added to a new separate VirtualHost but you set ServerName to an IP address, which will not work and instead Apache falls back to using default VirtualHost.
3. You do have proper FQDN and set ServerName to it, but did not enable the site where Linux distro requires it.

There can be otger reasons though and without knowing what exactly you have done so far I can help.

On 16 Dec 2024, at 6:28 AM, Nathan Ruffing <na...@rr34.us> wrote:



Nathan Ruffing

unread,
Dec 16, 2024, 5:28:51 AM12/16/24
to Graham Dumpleton, mod...@googlegroups.com
Thank you. I got Hello World to work. My problem for getting the Hello World app to work was simply the domain name and now that I know that I understand why. In order to use a virtual host, you need something to tell the server to use the virtual host and an IP address is insuffcient for that.

(So, beside the point, but does mod_wsgi not work at all without a domain name? I suppose there are other ways to direct to a virtual host, but I don't know how off the top of my head. Anyway, this is beside the point. I just used a domain name and Hello World worked.)

I develop on my own, so I really really really try to keep my stuff STANARD once it's outside the scope of what I know. I didn't tell you my configuration because
1. all I have to say about it is "normal and standard."
2. because I assume you're too busy to fix my problem for me.

That said, you can SSH in see my configuration for yourself:
IP: 23.254.144.125
user: graham
password: modwsgicreator

I don't know of a better way to show you my configuration. You can see where I renamed the apache2.conf file that works for the Hello World app and then I made a quick attempt at substituting in my app called tlom. tlom doesn't work, but you can see my goal I think.

Graham Dumpleton

unread,
Dec 16, 2024, 5:32:15 AM12/16/24
to Nathan Ruffing, mod...@googlegroups.com
I would delete that SSH access immediately as you are replying on a public forum.

On 16 Dec 2024, at 7:28 pm, Nathan Ruffing <na...@rr34.us> wrote:



Graham Dumpleton

unread,
Dec 16, 2024, 5:39:03 AM12/16/24
to Dumpleton Graham, Nathan Ruffing, mod...@googlegroups.com

Apache can use just an IP address instead of named virtual hosts, but the configuration would either need to be outside of any VirtualHost definition or in the default VirtualHost, which is the first VirtualHost Apache finds when reading the configuration.

If you have no FQDN of your own, you can use nip.io service. For example, use 23.254.144.125.nip.io as ServerName and then use same as hostname in URL. Go to nip.io to see explanation of what it does.

On 16 Dec 2024, at 7:32 pm, Graham Dumpleton <graham.d...@gmail.com> wrote:



Nathan Ruffing

unread,
Jan 5, 2025, 4:35:15 AMJan 5
to Graham Dumpleton, mod...@googlegroups.com
I finally got this working and THANK YOU for the help along the way.

I followed this video:
(video in this case helped me because I can watch him skip around to the various files, see where they are, and hear him talk about how they relate to each other as he does it)

Again thanks and I am excited to have this working. I use the app everyday at work with about 25 other people so it will be nice to not require me to be there serving it manually.
Reply all
Reply to author
Forward
0 new messages