Same result.  If the browser is directed to http://thegacway.com/zones/ the 
same error is generated.  Unfortunately, I don't believe I have a handle on 
the mechanisms / behaviors of this solution.  My understanding was that if 
a directory under the root directory did not have a .php file in that 
directory, apache would route the url request matching that directory to a 
python file in that directory, if it existed which is apparently not the 
case.  My understanding is now if there is a subdirectory which does not 
have a .php file then the request will be routed to main.py in the root 
directory, regardless of which directory was included in the URL.
On Friday, September 11, 2020 at 1:55:13 PM UTC-7 Graham Dumpleton wrote:

> If you are still using:
>
>     RewriteRule ^(.*)$ /main.py/$1 [QSA,PT,L]
>
> the file 'main.py' must be in the document root directory for Apache, 
> presumably next to 'index.php'.
>
> Try that first.
>
> Graham
>
> On 12 Sep 2020, at 6:52 am, Gordon Charles <[email protected]> wrote:
>
> Graham,
>
> I have not been successful in launching a python application.  My 
> understanding is the configuration should launch the php handler if it 
> finds a .php file in a directory and if not a .php file, but a ,py file 
> exists it should launch that.  The rules in the configuration file and the 
> code you have supplied for the python file want that file to be named 
> main.py.  So I created a subdirectory, zones, off of the root directory 
> with only main.py in that directory.  File permissions are read for all on 
> main.py and executable for all for the subdirectory.  group and owner are 
> the same for the root directory, the subdirectory and main.py.
>
> I get the following:
>
> [Fri Sep 11 20:48:22.125318 2020] [autoindex:error] [pid 63687] [client 
> 99.46.143.132:59742] AH01276: Cannot serve directory 
> /var/www/html/zones/: No matching DirectoryIndex (index.php) found, and 
> server-generated directory index forbidden by Options directive
>
> If I add Indexes to the Options directive, I get the directory listing of 
> http://thegacway.com/zones/.
>
> Any assistance would be appreciated.
>
> Regards,
>
> Gordon
> On Friday, September 11, 2020 at 8:51:31 AM UTC-7 Gordon Charles wrote:
>
>> Setting FollowSymLinks and SymLinksIfOwnerMatch worked.  Thank you.  I'm 
>> including the working .conf files for reference:
>>
>>
>> <Directory /var/www/html>
>>         Require all granted
>> </Directory>
>> WSGIRestrictEmbedded On
>> <VirtualHost *:80>
>>         ServerName thegacway.com
>>         ServerAlias www.thegacway.com
>>
>>         ServerAdmin webmaster@localhost
>>         DocumentRoot /var/www/html
>>
>>         # Define a mod_wsgi daemon process group.
>>         WSGIDaemonProcess www.thegacway.com display-name=%{GROUP}
>>         # Force the Python web application to run in the mod_wsgi daemon 
>> process group.
>>         WSGIProcessGroup www.thegacway.com
>>         WSGIApplicationGroup %{GLOBAL}
>>         # Disable embedded mode of mod_wsgi.
>>         # Set document root and rules for access.
>>         #DocumentRoot /var/www/html
>>         <Directory /var/www/html>
>>
>>             Options ExecCGI SymLinksIfOwnerMatch FollowSymLinks
>>
>>
>>             DirectoryIndex index.php
>>             AddHandler application/x-httpd-php .php
>>             AddHandler wsgi-script .py
>>             RewriteEngine On
>>             RewriteCond %{REQUEST_FILENAME} !-f
>>             RewriteCond %{REQUEST_FILENAME} !-d
>>             RewriteRule ^(.*)$ /main.py/$1 [QSA,PT,L]
>>         </Directory>
>>
>>         #LogLevel info ssl:warn
>>
>>         ErrorLog ${APACHE_LOG_DIR}/error.log
>>         CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>> </VirtualHost>
>> On Thursday, September 10, 2020 at 9:24:07 PM UTC-7 Graham Dumpleton 
>> wrote:
>>
>>> Is there is a reason why use of mod_rewrite is disabled by not 
>>> setting FollowSymLinks and SymLinksIfOwnerMatch. Can only presume then that 
>>> is due to that.
>>>
>>> On 11 Sep 2020, at 1:29 pm, Gordon Charles <[email protected]> wrote:
>>>
>>> Graham,
>>>
>>> I genuinely appreciate your help and patience; however, I believe we may 
>>> be struggling to communicate.  To be clear the .conf file I provided is the 
>>> one, only and the complete contents of the .conf file.  To be clear, yes I 
>>> would like the site(s) to be under the same address/port and the 
>>> configuration file I've sent you is my attempt to do so with the end goal 
>>> of being able to support either php generated by wordpress or python 
>>> supported by flask.
>>>
>>> Regards,
>>>
>>> Gordon
>>>
>>> On Thursday, September 10, 2020 at 7:00:25 PM UTC-7 Graham Dumpleton 
>>> wrote:
>>>
>>>> You can't have two VirtualHosts for same port with same ServerName. 
>>>> Apache will always use the first matching one it finds when doing named 
>>>> based virtual hosting.
>>>>
>>>> If you want both sites to be under the same host name, the 
>>>> configuration for each must be combined under the one VirtualHost 
>>>> definition.
>>>>
>>>> Graham
>>>>
>>>> On 11 Sep 2020, at 11:17 am, Gordon Charles <[email protected]> wrote:
>>>>
>>>> Graham,
>>>>
>>>> No it is not different.  My understanding having read your post Graham 
>>>> Dumpleton Post 
>>>> <http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html>, 
>>>> was that when configured Apache would dynamically route requests to either 
>>>> the .php or through wsgi based upon the file extensions of the files 
>>>> located in the particular directory.  My assumption is the 
>>>> ServerName/ServerAlias would be the same for both and Apache is "routing" 
>>>> the requests responses.  Based upon your response, I'm missing something; 
>>>> and as such, If it is not too much trouble I would appreciate any 
>>>> clarification you provide on the mechanics of how this would work when 
>>>> implemented correctly.
>>>>
>>>> On Thursday, September 10, 2020 at 5:29:45 PM UTC-7 Graham Dumpleton 
>>>> wrote:
>>>>
>>>>> What is the ServerName/ServerAlias for the wordpress VirtualHost? It 
>>>>> is different right?
>>>>>
>>>>> On 11 Sep 2020, at 10:00 am, Gordon Charles <[email protected]> wrote:
>>>>>
>>>>> Graham,
>>>>>
>>>>> Thanks for the quick reply.  I am striving to work independently 
>>>>> here.  I've made the modification, wordpress, is still not loading and 
>>>>> have 
>>>>> the following in the error.log file:
>>>>>
>>>>> [Thu Sep 10 23:53:15.963956 2020] [mpm_prefork:notice] [pid 40224] 
>>>>> AH00163: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- 
>>>>> resuming normal operations
>>>>> [Thu Sep 10 23:53:15.964004 2020] [core:notice] [pid 40224] AH00094: 
>>>>> Command line: '/usr/sbin/apache2'
>>>>> [Thu Sep 10 23:53:27.097927 2020] [rewrite:error] [pid 43290] [client 
>>>>> 99.46.143.132:55785] AH00670: Options FollowSymLinks and 
>>>>> SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also 
>>>>> forbidden due to its similar ability to circumvent directory restrictions 
>>>>> : 
>>>>> /var/www/html/wp-admin/, referer: http://thegacway.com/wp-login.php
>>>>>
>>>>> My assumption is that the configuration you have outlined should work 
>>>>> for wordpress in absence of any wsgi files and am trying to setup the 
>>>>> .conf 
>>>>> file so that it first works with wordpress and then add the python and 
>>>>> get 
>>>>> that working.
>>>>>
>>>>> Here's the configuration file:
>>>>>
>>>>> <Directory /var/www/html>
>>>>>         Require all granted
>>>>> </Directory>
>>>>> WSGIRestrictEmbedded On
>>>>> <VirtualHost *:80>
>>>>>         ServerName thegacway.com
>>>>>         ServerAlias www.thegacway.com
>>>>>
>>>>>         ServerAdmin webmaster@localhost
>>>>>         DocumentRoot /var/www/html
>>>>>
>>>>>         # Define a mod_wsgi daemon process group.
>>>>>         WSGIDaemonProcess www.thegacway.com display-name=%{GROUP}
>>>>>         # Force the Python web application to run in the mod_wsgi 
>>>>> daemon process group.
>>>>>         WSGIProcessGroup www.thegacway.com
>>>>>         WSGIApplicationGroup %{GLOBAL}
>>>>>         # Disable embedded mode of mod_wsgi.
>>>>>         # Set document root and rules for access.
>>>>>         #DocumentRoot /var/www/html
>>>>>         <Directory /var/www/html>
>>>>>             Options ExecCGI
>>>>>             DirectoryIndex index.php
>>>>>             AddHandler application/x-httpd-php .php
>>>>>             AddHandler wsgi-script .py
>>>>>             RewriteEngine On
>>>>>             RewriteCond %{REQUEST_FILENAME} !-f
>>>>>             RewriteCond %{REQUEST_FILENAME} !-d
>>>>>             RewriteRule ^(.*)$ /main.py/$1 [QSA,PT,L]
>>>>>         </Directory>
>>>>>
>>>>>         #LogLevel info ssl:warn
>>>>>
>>>>>         ErrorLog ${APACHE_LOG_DIR}/error.log
>>>>>         CustomLog ${APACHE_LOG_DIR}/access.log combined
>>>>>
>>>>> </VirtualHost>
>>>>> On Thursday, September 10, 2020 at 4:12:58 PM UTC-7 Graham Dumpleton 
>>>>> wrote:
>>>>>
>>>>>> Only WSGIRestrictEmbedded needs to be outside of the VirtualHost. 
>>>>>> Leave everything else you may have inside of the VirtualHost.
>>>>>>
>>>>>> On 11 Sep 2020, at 8:17 am, Gordon Charles <[email protected]> wrote:
>>>>>>
>>>>>> I've been trying to create a .conf file which would simultaneously 
>>>>>> support Wordpress and Flask (I have some flask apps which run as part of 
>>>>>> an 
>>>>>> embedded solution and would like for others to be able to drive the 
>>>>>> application in a simulation mode and like the idea of having a site wide 
>>>>>> implementation via flask for consistency.
>>>>>>
>>>>>> I've been following the guidance found here:
>>>>>> Graham Dumpleton Post 
>>>>>> <http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html>
>>>>>> and here:
>>>>>> mod_wsgi docs <https://modwsgi.readthedocs.io/en/develop/index.html>
>>>>>>
>>>>>> I'm running on Ubuntu 20.04.1 LTS
>>>>>> Apache/2.4.41
>>>>>> Python 3.8.2
>>>>>>
>>>>>> When I include the suggested configuration described in the Graham 
>>>>>> Dumpleton Post 
>>>>>> <http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html> 
>>>>>> inside 
>>>>>> of the VirtualHost definition I get the following:
>>>>>> WSGIRestrictEmbedded cannot occur within <VirtualHost> section
>>>>>> Action 'restart' failed.
>>>>>>
>>>>>> When I include the suggested configuration outside of the VirtualHost 
>>>>>> definition it breaks wordpress.
>>>>>>
>>>>>> Any guidance here would be appriciated.
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> 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 [email protected].
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/modwsgi/ded196fd-0b21-44ba-b6d5-b91b194e196dn%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/modwsgi/ded196fd-0b21-44ba-b6d5-b91b194e196dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>>
>>>>>>
>>>>> -- 
>>>>> 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 [email protected].
>>>>>
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/modwsgi/6b61b8c9-4a3b-4c1c-bfc7-6f732542f975n%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/modwsgi/6b61b8c9-4a3b-4c1c-bfc7-6f732542f975n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>>
>>>>>
>>>> -- 
>>>> 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 [email protected].
>>>>
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/modwsgi/a75ae12f-3f82-44c1-9deb-6dde36c844a2n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/modwsgi/a75ae12f-3f82-44c1-9deb-6dde36c844a2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>>
>>>>
>>> -- 
>>> 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 [email protected].
>>>
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/modwsgi/7576c999-0314-4c54-9287-229bed83abc2n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/modwsgi/7576c999-0314-4c54-9287-229bed83abc2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>>
> -- 
> 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 [email protected].
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/be184d21-d018-4068-b331-891939041d0bn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/be184d21-d018-4068-b331-891939041d0bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/5629a354-04e7-48ee-b2b5-3f02742d23a3n%40googlegroups.com.

Reply via email to