logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.



Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: [SOLVED] Virtual Host subdomains "Server Not Found"
Author
xtian



Joined: 11 Feb 2020
Posts: 2
Location: Glen Cove, NY

PostPosted: Thu 13 Feb '20 15:45    Post subject: [SOLVED] Virtual Host subdomains "Server Not Found" Reply with quote

Hi! I'm working on installing Apache2.4 + mod_wsgi on Windows 10 together with Miniconda Python 3.7. I found this tutorial which describes setting up Apache & mod_wsgi :

Flask App Deployment in Windows: Apache-Server & mod_wsgi.

It suggests using ApacheLounge's Windows binaries, so I thought this would be a good place to ask for advise to troubleshoot my Virtual Hosts setup.

I've completed the whole tutorial, and everything is working as expected up to "Configure a Virtual Host for the Flask App". Testing the URLs in a browser I get, "Server not found":

- We canít connect to the server at test-html.zorak.local.
- We canít connect to the server at test-wsgi.zorak.local.
- The URL `zorak.local` loads the content from `test-html.zorak.local` VirtualHost section of `httpd-vhosts.conf`.

Deviations from the tutorial are:
- install Apache to `C:/Users/me/Apache24`
- before pip install of mod_wsgi, I needed to run this line:
`set "MOD_WSGI_APACHE_ROOTDIR=C:\Users\me\Apache24"`
- I use different sub-directories for my test files, and I updated vhosts to match:

Code:
   
    + htdocs
    | + public-html
    | | - index.html
    | + pyauto
    | | + wsgi-test
    | | | - wsgi-test-app.py
    | | | + index
    | | | | - web.wsgi



- The tutorial has an error in the `httpd-vhosts.conf` file. <Directory> block is wrong as described in comments.

Testing configuration with `httpd -S` no obvious errors:

Code:

VirtualHost configuration:
*:80                   test-html.zorak.local (C:/Users/me/Apache24/conf/extra/httpd-vhosts.conf:40)
*:5000                 test-wsgi.zorak.local (C:/Users/me/Apache24/conf/extra/httpd-vhosts.conf:45)
ServerRoot: "C:/Users/me/Apache24"
Main DocumentRoot: "C:/Users/me/Apache24/htdocs"
Main ErrorLog: "C:/Users/me/Apache24/logs/error.log"
Mutex default: dir="C:/Users/me/Apache24/logs/" mechanism=default
PidFile: "C:/Users/me/Apache24/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: SRVROOT=c:\Users\me\Apache24


In httpd.conf I've:
- added `Listen 5000`
- uncommented `Include conf/extra/httpd-vhosts.conf`
- added the results of `mod-wsgi-express module-config` to the end of the file

Here is my file `httpd-vhosts.conf`:

Code:

<VirtualHost *:80>
    ServerAdmin chef@zorak.local
    ServerName test-html.zorak.local
    DocumentRoot "${SRVROOT}/htdocs/public-html"
    <Directory "${SRVROOT}/htdocs/public-html">
        Require all granted
    </Directory>
    ErrorLog "logs/test-html.zorak.local-error.log"
    CustomLog "logs/test-html.zorak.local-access.log" common
</VirtualHost>

<VirtualHost *:5000>
    ServerAdmin chef@zorak.local
    ServerName  test-wsgi.zorak.local
    WSGIScriptAlias / "${SRVROOT}/htdocs/pyauto/wsgi-test/index/web.wsgi"
    DocumentRoot "${SRVROOT}/htdocs/pyauto/wsgi-test"
    <Directory "${SRVROOT}/htdocs/pyauto/wsgi-test/index">
        Require all granted
    </Directory>
    ErrorLog "${SRVROOT}/htdocs/pyauto/wsgi-test/logs/test-wsgi.zorak.local-error.log"
    CustomLog "${SRVROOT}/htdocs/pyauto/wsgi-test/logs/test-wsgi.zorak.local-access.log" common
</VirtualHost>


`${SRVROOT}` is working because all of the error logs are created.

Maybe something small?

Just a technical detail--I'm installing the 32-bit version of Apache and Visual C++ Redistributable because a module I need in Python requires Miniconda 32-bit.


Last edited by xtian on Sun 23 Feb '20 2:23; edited 2 times in total
Back to top
xtian



Joined: 11 Feb 2020
Posts: 2
Location: Glen Cove, NY

PostPosted: Sun 23 Feb '20 2:22    Post subject: Reply with quote

I figured out the VHOSTS problem.

I forgot to fully setup the subdomains in Window's host file:

Code:

#c:\Windows\System32\Drivers\etc\hosts
127.0.0.1     zorak.local
127.0.0.1     test-html.zorak.local
127.0.0.1     test-wsgi.zorak.local


Also, I added another entry to `httpd-vhosts.conf` and solved the issue of the top level serving the subdomain's content.

Code:

# C:\Users\me\Apache24\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
    ServerName zorak.local
    DocumentRoot "${SRVROOT}/htdocs"
    <Directory "${SRVROOT}/htdocs">
        AllowOverride none
        Require all granted
    </Directory>
    ErrorLog "logs/zorak.local-error.log"
    CustomLog "logs/zorak.local-access.log" common
</VirtualHost>


To be clear, I'm getting another error now, `The server encountered an internal error or misconfiguration and was unable to complete your request.` So, wsgi & flask are not working just yet, but that's another issue (>_<)
Back to top


Reply to topic   Topic: [SOLVED] Virtual Host subdomains "Server Not Found" View previous topic :: View next topic
Post new topic   Forum Index -> Apache