Yep, good idea.

I included the garbage as suggested:

<VirtualHost *:80>

    ServerName www.example.com
    ServerAlias example.com mail.example.com
    ServerAdmin [email protected]

    Xasdkfgjhaksdjhfaksdjh
    WSGIScriptAlias / "/home/varilead/public_html/wsgi-scripts/myapp.wsgi"

    <Directory /home/varilead/public_html/wsgi-scripts>
    Order allow,deny
    Allow from all
    </Directory>

</VirtualHost>

With that, I got the following error:

The “/usr/sbin/httpd” command (process 15956) reported error number 1 when 
it ended. Configuration problem detected on line 9 of file 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp: Invalid 
command 'Xasdkfgjhaksdjhfaksdjh', perhaps misspelled or defined by a module 
not included in the server configuration --- 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp --- 3 4 5 
ServerName www.example.com ServerAlias example.com mail.example.com 7 
ServerAdmin [email protected] 8 9 ===> Xasdkfgjhaksdjhfaksdjh <=== 10 
WSGIScriptAlias / "/home/example/public_html/wsgi-scripts/myapp.wsgi" 11 12 
13 Order allow,deny 14 Allow from all 15 --- 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp ---  


I also tried putting the garbage later in the script to see if Apache 
chokes on the WSGIScriptAlias call:

<VirtualHost *:80>

    ServerName www.example.com
    ServerAlias example.com mail.example.com
    ServerAdmin [email protected]

    WSGIScriptAlias / "/home/varilead/public_html/wsgi-scripts/myapp.wsgi"

    <Directory /home/varilead/public_html/wsgi-scripts>
    Order allow,deny
    Allow from all
    </Directory>

    Xasdkfgjhaksdjhfaksdjh

</VirtualHost>

I got a similar error:

The “/usr/sbin/httpd” command (process 16055) reported error number 1 when 
it ended. Configuration problem detected on line 16 of file 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp: Invalid 
command 'Xasdkfgjhaksdjhfaksdjh', perhaps misspelled or defined by a module 
not included in the server configuration --- 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp --- 10 11 12 
Order allow,deny 13 Allow from all 14 15 16 ===> Xasdkfgjhaksdjhfaksdjh 
<=== 17 18 --- /etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp 
---

After removing the garbage, I can submit and don't get any errors.

I also tried removing the LoadModel for module_wsgi and left in the 
WSGIScriptAlias statement.  At that point, I get an error on 
WSGIScriptAlias.

The “/usr/sbin/httpd” command (process 16372) reported error number 1 when 
it ended. Configuration problem detected on line 7 of file 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp: Invalid 
command 'WSGIScriptAlias', perhaps misspelled or defined by a module not 
included in the server configuration --- 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp --- 1 2 3 
ServerName www.example.com 4 ServerAlias example.com mail.example.com 5 
ServerAdmin [email protected] 6 7 ===> WSGIScriptAlias / 
"/home/example/public_html/wsgi-scripts/myapp.wsgi" <=== 8 9 10 Order 
allow,deny 11 Allow from all 12 13 --- 
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.tmp ---  

It seems that Apache is loading module_wsgi; and that it recognizes 
WSGIScriptAlias as a valid command for module_wsgi.  But it doesn't seem to 
be using the  WSGIScriptAlias to establish the alias.

Could this have something to do with permissions for the Apache user?  I 
haven't been able to check anything on that front because I'm not clear 
about how to determine which user Apache is using.

On Friday, December 8, 2017 at 9:13:26 PM UTC-5, Graham Dumpleton wrote:
>
> Put some garbage in the configuration to trigged a syntax error. That is, 
> literally put in:
>
>     Xasdkfgjhaksdjhfaksdjh
>
> If the config is actually be included and use, Apache shouldn't start up.
>
> Graham
>
> On 9 Dec 2017, at 1:36 am, Jeff Robertson <[email protected] 
> <javascript:>> wrote:
>
> I'm still having some trouble with this setup...
>
>
>    - I am now seeing wsgi_module loaded in Apache
>    
> # httpd -M | grep wsgi
>  wsgi_module (shared)
>
>
>
>    - But the 'WSGIScriptAlias' statement does not seem to be taking 
>    effect.  The virtualhost portion of my httpd.conf looks like this... (I 
>    replaced just the domain portion with 'example'). As a reminder, I'm still 
>    having to use this interface in WHM that dynamically builds the httpd.conf 
>    file; and then 'includes' adjustments based on the interface... So the 
>    below is not the entirety of the virtualhost statement for this domain, it 
>    is an include statement that adjusts the httpd.conf. 
>
> <VirtualHost *:80>
>
>     ServerName www.example.com
>     ServerAlias example.com mail.example.com
>     ServerAdmin [email protected] <javascript:>
>
>     DocumentRoot /home/example/public_html
>
>     <Directory /home/example/public_html>
>     Order allow,deny
>     Allow from all
>     </Directory>
>
>     WSGIScriptAlias / "/home/example/public_html/wsgi-scripts/myapp.wsgi"
>
>     <Directory /home/example/public_html/wsgi-scripts>
>     Order allow,deny
>     Allow from all
>     </Directory>
>
> </VirtualHost>
>
>
>    - I ran '# httpd -S' and see the include statement mentioning *:80 is 
>    getting picked up in httpd:
>
> # httpd -S
> ...
> *:80                   www.example.com (/etc/apache2/conf.d/includes/
> pre_virtualhost_global.conf:4)
> ...
>
>
>
>
>    - When I attempt to visit www.example.com, I get an 'Index of /' with 
>    a list of '/home/example/public_html' instead of "/home/example
>    /public_html/wsgi-scripts/myapp.wsgi"
>
>
> Any ideas about why this would be happening? Are there any commands I can 
> run and show that would help diagnose?  It seems the mod_wsgi is loaded; 
> that the WSGIScriptAlias is being included; yet the alias is not pointing 
> to my application.
>
>
>
>
> On Wednesday, December 6, 2017 at 5:03:01 PM UTC-5, Jeff Robertson wrote:
>>
>> Trying to work through the installation of mod_wsgi ...
>>
>> It seems that I'm having trouble getting Apache to load the module.
>>
>> Some background details:
>>
>> # httpd -V
>> Server version: Apache/2.4.29 (cPanel)
>> Server built:   Nov 28 2017 15:27:38
>> Server's Module Magic Number: 20120211:68
>> Server loaded:  APR 1.5.2, APR-UTIL 1.5.2
>> Compiled using: APR 1.5.2, APR-UTIL 1.5.2
>> Architecture:   64-bit
>> Server MPM:
>> Server compiled with....
>>  -D APR_HAS_SENDFILE
>>  -D APR_HAS_MMAP
>>  -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
>>  -D APR_USE_SYSVSEM_SERIALIZE
>>  -D APR_USE_PTHREAD_SERIALIZE
>>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>>  -D APR_HAS_OTHER_CHILD
>>  -D AP_HAVE_RELIABLE_PIPED_LOGS
>>  -D DYNAMIC_MODULE_LIMIT=256
>>  -D HTTPD_ROOT="/etc/apache2"
>>  -D SUEXEC_BIN="/usr/sbin/suexec"
>>  -D DEFAULT_PIDLOG="/var/run/apache2/httpd.pid"
>>  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
>>  -D DEFAULT_ERRORLOG="logs/error_log"
>>  -D AP_TYPES_CONFIG_FILE="conf/mime.types"
>>  -D SERVER_CONFIG_FILE="conf/httpd.conf"
>>
>>
>>
>>
>> # httpd -l
>> Compiled in modules:
>>   core.c
>>   mod_so.c
>>   http_core.c
>>
>>
>>
>> # httpd -M
>> Loaded Modules:
>>  core_module (static)
>>  so_module (static)
>>  http_module (static)
>>  mpm_worker_module (shared)
>>  cgid_module (shared)
>>  access_compat_module (shared)
>>  actions_module (shared)
>>  alias_module (shared)
>>  asis_module (shared)
>>  auth_basic_module (shared)
>>  authn_core_module (shared)
>>  authn_file_module (shared)
>>  authz_core_module (shared)
>>  authz_groupfile_module (shared)
>>  authz_host_module (shared)
>>  authz_user_module (shared)
>>  autoindex_module (shared)
>>  cache_module (shared)
>>  dav_module (shared)
>>  dav_fs_module (shared)
>>  dbd_module (shared)
>>  deflate_module (shared)
>>  dir_module (shared)
>>  env_module (shared)
>>  expires_module (shared)
>>  filter_module (shared)
>>  headers_module (shared)
>>  include_module (shared)
>>  log_config_module (shared)
>>  logio_module (shared)
>>  mime_module (shared)
>>  negotiation_module (shared)
>>  proxy_module (shared)
>>  proxy_fcgi_module (shared)
>>  proxy_http_module (shared)
>>  proxy_wstunnel_module (shared)
>>  reqtimeout_module (shared)
>>  rewrite_module (shared)
>>  setenvif_module (shared)
>>  slotmem_shm_module (shared)
>>  socache_dbm_module (shared)
>>  socache_shmcb_module (shared)
>>  speling_module (shared)
>>  status_module (shared)
>>  suexec_module (shared)
>>  unique_id_module (shared)
>>  unixd_module (shared)
>>  userdir_module (shared)
>>  version_module (shared)
>>  ssl_module (shared)
>>  bwlimited_module (shared)
>>  security2_module (shared)
>>  suphp_module (shared)
>>
>>
>>
>> # mod_wsgi-express module-config
>> LoadModule wsgi_module 
>> "/home/varilead/mydjango/lib/python3.6/site-packages/mod_wsgi-4.5.22-py3.6-linux-x86_64.egg/mod_wsgi/server/
>> mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"
>> WSGIPythonHome "/home/varilead/mydjango"
>>
>>
>>
>> Apache configuration statement (I'm using WHM and it is making me use 
>> Include Editor to configure httpd.conf -- this statement goes into the "Pre 
>> Main Include" interface.)
>>
>> LoadModule wsgi_module 
>> "/home/varilead/mydjango/lib/python3.6/site-packages/mod_wsgi-4.5.22-py3.6-linux-x86_64.egg/mod_wsgi/server/
>> mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"
>> WSGIPythonHome "/home/varilead/mydjango"
>>
>> I have saved the configuration above and restarted Apache; I don't get 
>> any Apache errors at the restart.
>>
>> **Another background datapoint: I have python 2.7 loaded by default on my 
>> server; but I have python 3.6 loaded as well, and will be wanting to use 
>> that as a virtualenv when I run my project. Is there potentially come 
>> conflict with that scenaio? Are there other datapoints I can share that 
>> will help diagnose?
>>
>> # ldd mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
>>         linux-vdso.so.1 =>  (0x00007ffe20e00000)
>>         libpython3.6m.so.1.0 => /usr/local/lib/libpython3.6m.so.1.0 (
>> 0x00007f21236d8000)
>>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f21234b8000)
>>         libc.so.6 => /lib64/libc.so.6 (0x00007f2123120000)
>>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f2122f18000)
>>         libutil.so.1 => /lib64/libutil.so.1 (0x00007f2122d10000)
>>         librt.so.1 => /lib64/librt.so.1 (0x00007f2122b08000)
>>         libm.so.6 => /lib64/libm.so.6 (0x00007f2122880000)
>>         /lib64/ld-linux-x86-64.so.2 (0x00007f2123e28000)
>>
>>
>> When I re-run "httpd - m", I don't see wsgi_module in the list.  What 
>> other indications should I be looking for to know if mod_wsgi was 
>> successfully loaded?
>>
>> Any help?
>>
>
> -- 
> 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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to