This is the final part of the puzzle for me. If I wanted to run things from a 
virtualenv, what would be the required changes? 

Location of desired virtualenv:

/home/user/.virtualenvs/myenv

—Rajeev



> On Jun 23, 2018, at 9:52 PM, Rajeev Jain <[email protected]> wrote:
> 
> On Jun 23, 2018, at 9:36 PM, Graham Dumpleton <[email protected] 
> <mailto:[email protected]>> wrote:
>> 
>> Possibly because for the other ports you opened up the firewall on the host 
>> so they can be accessed from outside, but you didn't do that for port 83.
>> 
> 
> 
> Bingo! 
> 
> sudo ufw allow 83
> 
> 
> It is working from all the other computers!!
> 
> Thank-you so much. You are awesome. 
> 
> —Rajeev
> 
> 
> 
>> Graham
>> 
>>> On 24 Jun 2018, at 2:35 pm, Rajeev Jain <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>>> 
>>>> On Jun 23, 2018, at 4:42 PM, Graham Dumpleton <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> Run the curl on the same host and use:
>>>> 
>>>>     curl http://127.0.0.1:83 <http://127.0.0.1:83/>
>>>> 
>>> 
>>> 
>>> From the server both the curl command and browser are working correctly:
>>> 
>>> 
>>> $curl http://192.168.1.14:83 <http://192.168.1.14:83/>
>>> Hello, this is running from flasK!
>>> 
>>> $curl http://127.0.0.1:83 <http://127.0.0.1:83/>
>>> Hello, this is running from flasK!
>>> 
>>> Browser not shown but working correctly.
>>> 
>>> Those same URLs do not work at all (curl or browser) from a different 
>>> computer on the network.
>>> 
>>> Note the other 3 virtualservers are working using curl or browser from any 
>>> computer on the network:
>>> 
>>> http://192.168.1.14:80 <http://192.168.1.14/>
>>> http://192.168.1.14:81 <http://192.168.1.14:81/>
>>> http://192.168.1.14:82 <http://192.168.1.14:82/>
>>> 
>>> Why 192.168.1.14:83 is not accessible from other computer?
>>> 
>>> 
>>>> Try doing a complete 'stop' and 'start' of Apache, not just a 'reload’.
>>> 
>>> To restart apache I’m using the following:
>>> 
>>> $ sudo service apache2 restart
>>> 
>>> Is this the right command (i.e. will is reload changes in the configuration 
>>> and restart the server)? 
>>> 
>>> If not, which command to use?
>>> 
>>>> 
>>>> BTW, you don't need the CustomLog directive either since would be same as 
>>>> main Apache one.
>>>> 
>>> 
>>> ok i removed that line. here is most recent:
>>> 
>>> cat /etc/apache2/sites-available/FlaskApp.conf
>>> <VirtualHost *:83>
>>>             ServerName flaskapp.com <http://flaskapp.com/>
>>>             ServerAdmin [email protected] <mailto:[email protected]>
>>>             WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
>>>             <Directory /var/www/FlaskApp/>
>>>                     Require all granted
>>>             </Directory>
>>>             LogLevel info
>>> </VirtualHost>
>>> 
>>> 
>>> Whats’s next…it seems we are close.
>>> 
>>> —Rajeev
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> Graham
>>>> 
>>>>> On 24 Jun 2018, at 8:55 am, Rajeev Jain <[email protected] 
>>>>> <mailto:[email protected]>> wrote:
>>>>> 
>>>>> good question. yes that has been added:
>>>>> 
>>>>> ccat /etc/apache2/ports.conf
>>>>> # If you just change the port or add more ports here, you will likely also
>>>>> # have to change the VirtualHost statement in
>>>>> # /etc/apache2/sites-enabled/000-default.conf
>>>>> 
>>>>> Listen 80
>>>>> Listen 81
>>>>> Listen 82
>>>>> Listen 83
>>>>> 
>>>>> <IfModule ssl_module>
>>>>>   Listen 443
>>>>> </IfModule>
>>>>> 
>>>>> <IfModule mod_gnutls.c>
>>>>>   Listen 443
>>>>> </IfModule>
>>>>> 
>>>>> any chance you can call me or i can call you? if yes please email my 
>>>>> personal email: cjainraje@yahoo.
>>>>> 
>>>>> 
>>>>> 
>>>>> On Jun 23, 2018, at 3:53 PM, Graham Dumpleton <[email protected] 
>>>>> <mailto:[email protected]>> wrote:
>>>>> 
>>>>> Have you added a:
>>>>> 
>>>>>     Listen 83
>>>>> 
>>>>> directive to Apache so it knows to listed on that port?
>>>>> 
>>>>> Graham
>>>>> 
>>>>>> On 24 Jun 2018, at 8:52 am, Rajeev Jain <[email protected] 
>>>>>> <mailto:[email protected]>> wrote:
>>>>>> 
>>>>>> I fixed the items in you email. See my comments inline and below for 
>>>>>> details:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> I rebooted.
>>>>>> 
>>>>>>  and unfortunately curl command is not working:
>>>>>> curl http://192.168.1.14:83 <http://192.168.1.14:83/>
>>>>>> curl: (7) Failed to connect to 192.168.1.14 port 83: Operation timed out
>>>>>> 
>>>>>> 
>>>>>> Here is error.log
>>>>>> tail -f /var/log/apache2/error.log
>>>>>> [Sat Jun 23 14:48:49.945490 2018] [mpm_prefork:notice] [pid 2625] 
>>>>>> AH00169: caught SIGTERM, shutting down
>>>>>> [Sat Jun 23 14:49:22.977595 2018] [ssl:warn] [pid 2170] AH01909: 
>>>>>> 198.105.244.228:443:0 server certificate does NOT include an ID which 
>>>>>> matches the server name
>>>>>> [Sat Jun 23 14:49:23.145018 2018] [ssl:warn] [pid 2171] AH01909: 
>>>>>> 198.105.244.228:443:0 server certificate does NOT include an ID which 
>>>>>> matches the server name
>>>>>> [Sat Jun 23 14:49:23.151437 2018] [mpm_prefork:notice] [pid 2171] 
>>>>>> AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.6.4 Python/3.6 
>>>>>> configured -- resuming normal operations
>>>>>> [Sat Jun 23 14:49:23.151475 2018] [core:notice] [pid 2171] AH00094: 
>>>>>> Command line: '/usr/sbin/apache2'
>>>>>> [Sat Jun 23 15:40:33.636711 2018] [mpm_prefork:notice] [pid 2171] 
>>>>>> AH00169: caught SIGTERM, shutting down
>>>>>> [Sat Jun 23 15:41:06.959491 2018] [ssl:warn] [pid 2149] AH01909: 
>>>>>> 198.105.244.228:443:0 server certificate does NOT include an ID which 
>>>>>> matches the server name
>>>>>> [Sat Jun 23 15:41:07.131568 2018] [ssl:warn] [pid 2151] AH01909: 
>>>>>> 198.105.244.228:443:0 server certificate does NOT include an ID which 
>>>>>> matches the server name
>>>>>> [Sat Jun 23 15:41:07.135495 2018] [mpm_prefork:notice] [pid 2151] 
>>>>>> AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.6.4 Python/3.6 
>>>>>> configured -- resuming normal operations
>>>>>> [Sat Jun 23 15:41:07.135532 2018] [core:notice] [pid 2151] AH00094: 
>>>>>> Command line: '/usr/sbin/apache2'
>>>>>> 
>>>>>> 
>>>>>> FYI, updated/most recent:
>>>>>> cat /etc/apache2/sites-available/FlaskApp.conf
>>>>>> <VirtualHost *:83>
>>>>>>          ServerName flaskapp.com <http://flaskapp.com/>
>>>>>>          ServerAdmin [email protected] <mailto:[email protected]>
>>>>>>          WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
>>>>>>          <Directory /var/www/FlaskApp/>
>>>>>>                  Require all granted
>>>>>>          </Directory>
>>>>>>          LogLevel info
>>>>>>          CustomLog ${APACHE_LOG_DIR}/access.log combined
>>>>>> </VirtualHost>
>>>>>> 
>>>>>> 
>>>>>> can we use mod_wsgi-express to help us get this setup?
>>>>>> 
>>>>>> —Rajeev
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Jun 23, 2018, at 3:24 PM, Graham Dumpleton 
>>>>>> <[email protected] <mailto:[email protected]>> wrote:
>>>>>> 
>>>>>> Is FlaskApp.conf symlinked into sites-enabled directory?
>>>>>> 
>>>>>> If it isn't then it will not even be used.
>>>>>> 
>>>>>> [rajeev]
>>>>>> yes it is
>>>>>> /etc/apache2/sites-enabled$ ll Flask*
>>>>>> lrwxrwxrwx 1 root root 32 Jun 12 19:50 FlaskApp.conf -> 
>>>>>> ../sites-available/FlaskApp.conf
>>>>>> 
>>>>>> and it is enabled:
>>>>>> /etc/apache2/sites-available$ sudo a2ensite FlaskApp
>>>>>> [sudo] password for rajeev: 
>>>>>> Site FlaskApp already enabled
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>>     WSGIPythonHome "/usr"
>>>>>> 
>>>>>> Are you not using a Python virtual environment?
>>>>>> 
>>>>>> [rajeev]
>>>>>> my thinking was to get this working at the system level and then migrate 
>>>>>> to a virtual environment. if better to start with a virtualenv then 
>>>>>> let’s do so. i have one already setup:
>>>>>> 
>>>>>> virtualenv-location: /home/rajeev/.virtualenvs/smdb-prod
>>>>>> 
>>>>>> either system or virtualenv is fine for me. i’ll go with your 
>>>>>> recommendation. please do advise.
>>>>>> 
>>>>>> 
>>>>>> Also good practice to use mod_wsgi daemon mode.
>>>>>> 
>>>>>> [rajeev]
>>>>>> please advise how to use mod_wsgi daemon mode.
>>>>>> 
>>>>>>> 3) FlaskApp.conf
>>>>>>> cat /etc/apache2/sites-available/FlaskApp.conf
>>>>>>> <VirtualHost *:83>
>>>>>>>                 ServerName flaskapp.com <http://flaskapp.com/>
>>>>>>>                 ServerAdmin [email protected] 
>>>>>>> <mailto:[email protected]>
>>>>>>>                 WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
>>>>>>>                 <Directory /var/www/FlaskApp/FlaskApp/>
>>>>>> 
>>>>>> This directory path is wrong. Should be:
>>>>>> 
>>>>>>     <Directory /var/www/FlaskApp/>
>>>>>>  
>>>>>>>                         Order allow,deny
>>>>>>>                         Allow from all
>>>>>> 
>>>>>> For Apache 2.4 you should be using:
>>>>>> 
>>>>>>     Require all granted
>>>>>> 
>>>>>>>                 </Directory>
>>>>>>>                 ErrorLog ${APACHE_LOG_DIR}/error.log
>>>>>> 
>>>>>> No point setting this here if not setting it different to main Apache 
>>>>>> error log.
>>>>>> 
>>>>>>>                 LogLevel warn
>>>>>> 
>>>>>> Set this to:
>>>>>> 
>>>>>>     LogLevel info
>>>>>> 
>>>>>> That way mod_wsgi will log details about when it loads scripts and you 
>>>>>> will know if request is actually making it to mod_wsgi.
>>>>>> 
>>>>>> So fix above things, ensuring your site is enabled and do curl again.
>>>>>> 
>>>>>> What appears in the error log from when the request is made? Does it 
>>>>>> show mod_wsgi loading your script?
>>>>>> 
>>>>>> Graham
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> 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] 
>>>>>> <mailto:[email protected]>.
>>>>>> To post to this group, send email to [email protected] 
>>>>>> <mailto:[email protected]>.
>>>>>> Visit this group at https://groups.google.com/group/modwsgi 
>>>>>> <https://groups.google.com/group/modwsgi>.
>>>>>> For more options, visit https://groups.google.com/d/optout 
>>>>>> <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] 
>>>>>> <mailto:[email protected]>.
>>>>>> To post to this group, send email to [email protected] 
>>>>>> <mailto:[email protected]>.
>>>>>> Visit this group at https://groups.google.com/group/modwsgi 
>>>>>> <https://groups.google.com/group/modwsgi>.
>>>>>> For more options, visit https://groups.google.com/d/optout 
>>>>>> <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] 
>>>>> <mailto:[email protected]>.
>>>>> To post to this group, send email to [email protected] 
>>>>> <mailto:[email protected]>.
>>>>> Visit this group at https://groups.google.com/group/modwsgi 
>>>>> <https://groups.google.com/group/modwsgi>.
>>>>> For more options, visit https://groups.google.com/d/optout 
>>>>> <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] 
>>>>> <mailto:[email protected]>.
>>>>> To post to this group, send email to [email protected] 
>>>>> <mailto:[email protected]>.
>>>>> Visit this group at https://groups.google.com/group/modwsgi 
>>>>> <https://groups.google.com/group/modwsgi>.
>>>>> For more options, visit https://groups.google.com/d/optout 
>>>>> <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] 
>>>> <mailto:[email protected]>.
>>>> To post to this group, send email to [email protected] 
>>>> <mailto:[email protected]>.
>>>> Visit this group at https://groups.google.com/group/modwsgi 
>>>> <https://groups.google.com/group/modwsgi>.
>>>> For more options, visit https://groups.google.com/d/optout 
>>>> <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] 
>>> <mailto:[email protected]>.
>>> To post to this group, send email to [email protected] 
>>> <mailto:[email protected]>.
>>> Visit this group at https://groups.google.com/group/modwsgi 
>>> <https://groups.google.com/group/modwsgi>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <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] 
>> <mailto:[email protected]>.
>> To post to this group, send email to [email protected] 
>> <mailto:[email protected]>.
>> Visit this group at https://groups.google.com/group/modwsgi 
>> <https://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout 
>> <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