Categories: python, apache, flask

Issue getting subdomains to route properly in Apache 2.4

1 answer

I'm setting up some simple Flask apps and trying to make them availble on the Web via a subdomain.

This is what I am trying to achieve:

  • Traffic to to route through to, run a specific Python Flask app and respond with JSON response.
  • Traffic to to route through to and run a specific Python Flask app and respond with JSON response.

Using Apache2.4 and Flask (Python 3.6) on a Windows Server 2012 R2 AWS EC2 machine, I have done the following: - Changed my service provider’s DNS settings to point at - Set Apache to listen on port 80. - Set up the virtualhosts conf file (httpd-vhosts.conf).

The virtual hosts file looks as follows:

   <VirtualHost *:80>     ServerAdmin [email protected]     ServerName     WSGIApplicationGroup %{GLOBAL      WSGIScriptAlias /friend/friends/v1 "C:/Projects/friend/friends/v1/web.wsgi"     DocumentRoot C:/Projects/friend/friends /v1     <Directory "C:/Projects/friend/friends/v1">         Options -Includes -Indexes -ExecCGI -FollowSymLinks         AllowOverride None         Require all granted     </Directory>      WSGIScriptAlias /family/families/v1 "C:/Projects/family/families/v1/web.wsgi"     DocumentRoot C:/Projects/family/families/v1     <Directory "C:/Projects/family/families/v1">         Options -Includes -Indexes -ExecCGI -FollowSymLinks         AllowOverride None         Require all granted     </Directory>      ErrorLog "C:/Projects/logs/error.log"     CustomLog "C:/Projects/logs/access.log" common     </VirtualHost> 

When I try or in a browser, everything works exactly as it should and the vhosts file is being read and acted on.

When I try or in a browser, I get “Forbidden You don't have permission to access this resource” and the address bar URL simply changes to

What am I doing wrong? What setting am I leaving out?

As an Apache newbie, I need some help.

Many thanks

All answers to this question, which has the identifier 57739781

The best answer:

If you want your VirtualHost to respond to, you need to set that as the ServerName or ServerAlias.

Last questions

how do i remove the switch on my home screen?
how to edit the JS date and time to update atuomatically?
How to utilize data stored in a multidimensional array
Powermockito not mocking URL constructor in URI.toURL() method
Android Bluetooth LE Scanner only scans when phone's Location is turned on in some devices
docker wordpress container can't connect to mysql container
How can I declare a number in java that is more than 64-bits? [duplicate]
Optaplanner solutionClass entityCollectionProperty should never return null error when simple JSON object passed to controller
Anylogic, get the time a pedestrain is in a queue
How do I fix this syntax issue with my .flex file?
Optimizing query in PHP
How to find the highest number of a column and print two columns of that row in R?
Ideas on “Error: Type is referenced as an interface from”?
JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()
PHP total order
Laravel booking system design
neural net - undefined column selected
How to indicate y axis does not start from 0 in ggplot?
Fragments in backStack
Spinner how to change the data