Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-21 Thread Gordon Charles
Graham,

After you stated the expected behavior in this thread,  I did spend the 
time to read through the Apache documentation on RewriteCond and 
RewriteRule (in particular the flags); however, even if I had read the 
Apache documentation and interpreted it correctly prior to following the 
post I would have doubted my own interpretation based upon the language in 
your post - deferring to expert.  Thanks again for all the help.

Cheers,

Gordon

On Saturday, September 19, 2020 at 7:59:57 PM UTC-7 Gordon Charles wrote:

> Graham,
>
> A gracious thank you for your help and all the effort you have put into 
> mod_wsgi.  Removing the zones subdirectory resulted in the launching of 
> main.py and the site is now working as expected.  While not in this space 
> and predominantly in IC development, my organization and myself have had to 
> support customer facing products and as a result support those who do not 
> read the documentation throughly.  In the spirit of understanding how 
> guilty I was of not reading throughly I went back and re-read your post and 
> reading it a second time I still come away with the impression that an 
> empty directory should result in the correct behavior, which clearly it 
> does not.  The line which convinces me of this is "If however the URL could 
> not be mapped to an actual physical file in the document directory, the 
> request will be rewritten such that the request will be redirected to the 
> resource 'main.py'."  While I may not fully appreciate this line in the 
> context of the article, I'm bringing it to your attention so you are aware 
> of at least where one reader became lost.
>
> Cheers,
>
> Gordon
> On Saturday, September 12, 2020 at 10:41:02 PM UTC-7 Graham Dumpleton 
> wrote:
>
>> What is the 'zones' sub directory under the document root for?
>>
>> A request will only be redirected to use main.py in document root as 
>> handler if the URL path doesn't match either a directory or any file (not 
>> just .php files).
>>
>> So if you have a 'zones' sub directory, and use a URL with path of 
>> /zones, then it matches the directory and tries to serve up a directory 
>> listing of it if index generation is enabled, or otherwise will fail. It 
>> will not redirect to 'main.py' in that case.
>>
>> So for any URL path you want handled by the Python `main.py`, there 
>> cannot be a directory or file which would be matched by it.
>>
>> Graham
>>
>> On 12 Sep 2020, at 7:34 am, Gordon Charles  wrote:
>>
>> 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  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:


 
  

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-20 Thread Graham Dumpleton
The behaviour is dictated by:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

This in combination says to rewrite it if the target is neither a file or a 
directory.

Technically you could remove the second one for the directory (I think), and if 
the URL had matched to a directory it would still redirect to the WSGI 
application.

If however you had wanted Apache to do directory indexes, then you probably 
wouldn't want to do it.

So the configuration explains the exact behaviour, but then I guess it depends 
on whether you understood what the configuration was doing. :-)

Graham 

> On 20 Sep 2020, at 12:59 pm, Gordon Charles  wrote:
> 
> Graham,
> 
> A gracious thank you for your help and all the effort you have put into 
> mod_wsgi.  Removing the zones subdirectory resulted in the launching of 
> main.py and the site is now working as expected.  While not in this space and 
> predominantly in IC development, my organization and myself have had to 
> support customer facing products and as a result support those who do not 
> read the documentation throughly.  In the spirit of understanding how guilty 
> I was of not reading throughly I went back and re-read your post and reading 
> it a second time I still come away with the impression that an empty 
> directory should result in the correct behavior, which clearly it does not.  
> The line which convinces me of this is "If however the URL could not be 
> mapped to an actual physical file in the document directory, the request will 
> be rewritten such that the request will be redirected to the resource 
> 'main.py'."  While I may not fully appreciate this line in the context of the 
> article, I'm bringing it to your attention so you are aware of at least where 
> one reader became lost.
> 
> Cheers,
> 
> Gordon
> On Saturday, September 12, 2020 at 10:41:02 PM UTC-7 Graham Dumpleton wrote:
> What is the 'zones' sub directory under the document root for?
> 
> A request will only be redirected to use main.py in document root as handler 
> if the URL path doesn't match either a directory or any file (not just .php 
> files).
> 
> So if you have a 'zones' sub directory, and use a URL with path of /zones, 
> then it matches the directory and tries to serve up a directory listing of it 
> if index generation is enabled, or otherwise will fail. It will not redirect 
> to 'main.py' in that case.
> 
> So for any URL path you want handled by the Python `main.py`, there cannot be 
> a directory or file which would be matched by it.
> 
> Graham
> 
> 
>> On 12 Sep 2020, at 7:34 am, Gordon Charles > > wrote:
>> 
> 
>> 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 gmail.com 
>>> > 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/ 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-19 Thread Gordon Charles
Graham,

A gracious thank you for your help and all the effort you have put into 
mod_wsgi.  Removing the zones subdirectory resulted in the launching of 
main.py and the site is now working as expected.  While not in this space 
and predominantly in IC development, my organization and myself have had to 
support customer facing products and as a result support those who do not 
read the documentation throughly.  In the spirit of understanding how 
guilty I was of not reading throughly I went back and re-read your post and 
reading it a second time I still come away with the impression that an 
empty directory should result in the correct behavior, which clearly it 
does not.  The line which convinces me of this is "If however the URL could 
not be mapped to an actual physical file in the document directory, the 
request will be rewritten such that the request will be redirected to the 
resource 'main.py'."  While I may not fully appreciate this line in the 
context of the article, I'm bringing it to your attention so you are aware 
of at least where one reader became lost.

Cheers,

Gordon
On Saturday, September 12, 2020 at 10:41:02 PM UTC-7 Graham Dumpleton wrote:

> What is the 'zones' sub directory under the document root for?
>
> A request will only be redirected to use main.py in document root as 
> handler if the URL path doesn't match either a directory or any file (not 
> just .php files).
>
> So if you have a 'zones' sub directory, and use a URL with path of /zones, 
> then it matches the directory and tries to serve up a directory listing of 
> it if index generation is enabled, or otherwise will fail. It will not 
> redirect to 'main.py' in that case.
>
> So for any URL path you want handled by the Python `main.py`, there cannot 
> be a directory or file which would be matched by it.
>
> Graham
>
> On 12 Sep 2020, at 7:34 am, Gordon Charles  wrote:
>
> 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  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:
>>>
>>>
>>> 
>>> Require all granted
>>> 
>>> WSGIRestrictEmbedded On
>>> 
>>> 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.

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-12 Thread Graham Dumpleton
What is the 'zones' sub directory under the document root for?

A request will only be redirected to use main.py in document root as handler if 
the URL path doesn't match either a directory or any file (not just .php files).

So if you have a 'zones' sub directory, and use a URL with path of /zones, then 
it matches the directory and tries to serve up a directory listing of it if 
index generation is enabled, or otherwise will fail. It will not redirect to 
'main.py' in that case.

So for any URL path you want handled by the Python `main.py`, there cannot be a 
directory or file which would be matched by it.

Graham

> On 12 Sep 2020, at 7:34 am, Gordon Charles  wrote:
> 
> 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 > > 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:
>> 
>> 
>> 
>> Require all granted
>> 
>> WSGIRestrictEmbedded On
>> 
>> 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
>> 
>> 
>> 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]
>> 
>> 
>> #LogLevel info ssl:warn
>> 
>> ErrorLog ${APACHE_LOG_DIR}/error.log
>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>> 
>> 
>> 
>> 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 > wrote:
>>> 
>> 
>>> Graham,
>>> 
>>> I genuinely appreciate your help and patience; 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-11 Thread Gordon Charles
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  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:
>>
>>
>> 
>> Require all granted
>> 
>> WSGIRestrictEmbedded On
>> 
>> 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
>> 
>>
>> 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]
>> 
>>
>> #LogLevel info ssl:warn
>>
>> ErrorLog ${APACHE_LOG_DIR}/error.log
>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>> 
>> 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  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  wrote:

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-11 Thread Graham Dumpleton
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  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:
> 
> 
> 
> Require all granted
> 
> WSGIRestrictEmbedded On
> 
> 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
> 
> 
> 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]
> 
> 
> #LogLevel info ssl:warn
> 
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> 
> 
> 
> 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 > 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 > wrote:
>>> 
>> 
>>> Graham,
>>> 
>>> No it is not different.  My understanding having read your post Graham 
>>> Dumpleton Post 
>>> , 
>>> 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 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-11 Thread Gordon Charles
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:
>
> 
> Require all granted
> 
> WSGIRestrictEmbedded On
> 
> 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
> 
>
> 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]
> 
>
> #LogLevel info ssl:warn
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> 
> 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  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  wrote:
>>>
>>> Graham,
>>>
>>> No it is not different.  My understanding having read your post Graham 
>>> Dumpleton Post 
>>> , 
>>> 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  wrote:

 Graham,

 Thanks for the quick reply.  I am striving to work independently here.  
 I've made the modification, wordpress, is still 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-11 Thread Gordon Charles
Setting FollowSymLinks and SymLinksIfOwnerMatch worked.  Thank you.  I'm 
including the working .conf files for reference:


Require all granted

WSGIRestrictEmbedded On

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

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]


#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


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  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  wrote:
>>
>> Graham,
>>
>> No it is not different.  My understanding having read your post Graham 
>> Dumpleton Post 
>> , 
>> 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  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:
>>>
>>> 
>>> Require all granted
>>> 
>>> WSGIRestrictEmbedded On
>>> 
>>> ServerName thegacway.com
>>> ServerAlias www.thegacway.com
>>>
>>> ServerAdmin webmaster@localhost
>>> DocumentRoot /var/www/html
>>>
>>> # Define a mod_wsgi daemon process 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Graham Dumpleton
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  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 > > wrote:
>> 
> 
>> Graham,
>> 
>> No it is not different.  My understanding having read your post Graham 
>> Dumpleton Post 
>> , 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 > 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:
>>> 
>>> 
>>> Require all granted
>>> 
>>> WSGIRestrictEmbedded On
>>> 
>>> 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
>>> 
>>> 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]
>>> 
>>> 
>>> #LogLevel info ssl:warn
>>> 
>>> ErrorLog ${APACHE_LOG_DIR}/error.log
>>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>>> 
>>> 
>>> 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 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Gordon Charles
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  wrote:
>
> Graham,
>
> No it is not different.  My understanding having read your post Graham 
> Dumpleton Post 
> , 
> 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  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:
>>
>> 
>> Require all granted
>> 
>> WSGIRestrictEmbedded On
>> 
>> 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
>> 
>> 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]
>> 
>>
>> #LogLevel info ssl:warn
>>
>> ErrorLog ${APACHE_LOG_DIR}/error.log
>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>> 
>> 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  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 
>>> 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Graham Dumpleton
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  wrote:
> 
> Graham,
> 
> No it is not different.  My understanding having read your post Graham 
> Dumpleton Post 
> , 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 > > 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:
>> 
>> 
>> Require all granted
>> 
>> WSGIRestrictEmbedded On
>> 
>> 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
>> 
>> 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]
>> 
>> 
>> #LogLevel info ssl:warn
>> 
>> ErrorLog ${APACHE_LOG_DIR}/error.log
>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>> 
>> 
>> 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 > 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 
>>> 
>>> and here:
>>> mod_wsgi docs 
>>> 
>>> 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 
>>> 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Gordon Charles
Graham,

No it is not different.  My understanding having read your post Graham 
Dumpleton Post 
, 
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  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:
>
> 
> Require all granted
> 
> WSGIRestrictEmbedded On
> 
> 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
> 
> 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]
> 
>
> #LogLevel info ssl:warn
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> 
> 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  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 
>> 
>> and here:
>> mod_wsgi docs 
>>
>> 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 
>>  
>> inside 
>> of the VirtualHost definition I get the following:
>> WSGIRestrictEmbedded cannot occur within  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 modwsgi+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Graham Dumpleton
What is the ServerName/ServerAlias for the wordpress VirtualHost? It is 
different right?

> On 11 Sep 2020, at 10:00 am, Gordon Charles  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:
> 
> 
> Require all granted
> 
> WSGIRestrictEmbedded On
> 
> 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
> 
> 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]
> 
> 
> #LogLevel info ssl:warn
> 
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> 
> 
> 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 > > 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 
>> 
>> and here:
>> mod_wsgi docs 
>> 
>> 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  
>> inside of the VirtualHost definition I get the following:
>> WSGIRestrictEmbedded cannot occur within  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 modwsgi+u...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/modwsgi/ded196fd-0b21-44ba-b6d5-b91b194e196dn%40googlegroups.com
>>  
>> .
> 
> 
> -- 
> 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+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/6b61b8c9-4a3b-4c1c-bfc7-6f732542f975n%40googlegroups.com
>  
> .

-- 
You received this 

Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Gordon Charles
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:


Require all granted

WSGIRestrictEmbedded On

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

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]


#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


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  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 
> 
> and here:
> mod_wsgi docs 
>
> 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 
>  
> inside 
> of the VirtualHost definition I get the following:
> WSGIRestrictEmbedded cannot occur within  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 modwsgi+u...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/ded196fd-0b21-44ba-b6d5-b91b194e196dn%40googlegroups.com
>  
> 
> .
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/6b61b8c9-4a3b-4c1c-bfc7-6f732542f975n%40googlegroups.com.


Re: [modwsgi] Wordpress & Flask sitewide implimentation

2020-09-10 Thread Graham Dumpleton
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  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 
> 
> and here:
> mod_wsgi docs 
> 
> 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  
> inside of the VirtualHost definition I get the following:
> WSGIRestrictEmbedded cannot occur within  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 modwsgi+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/ded196fd-0b21-44ba-b6d5-b91b194e196dn%40googlegroups.com
>  
> .

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/744D88C3-52A0-49FE-A9DA-F5C3DA955E43%40gmail.com.