Re: [web2py] Re: How to solve the Nginx error on digitalocean

2019-07-16 Thread Maurice Waka
Used the link as you directed

posted this:
# file /etc/nginx/sites-available/web2py
server {
listen  80;
server_name 165.22.57.107;
#to enable correct use of response.static_version
#location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
#alias /web2py/applications/$1/static/$2;
#expires max;
#}
location ~* /(\w+)/static/ {
root /web2py/applications/;
#remove next comment on production
#expires max;
}
location / {
#uwsgi_pass  127.0.0.1:8000;
uwsgi_pass  unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}
}
server {
listen 443 default_server ssl;
server_name 165.22.57.107;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers
ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols SSLv3 TLSv1;
keepalive_timeout70;
location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}

}


But got this error:

nginx: [emerg] "server" directive is not allowed here in
/etc/nginx/nginx.conf:86


On Mon, Jul 15, 2019 at 4:39 PM Jim S  wrote:

> I don't think server can be a root element in this file.  Do you have it
> under another element?  I'd try it like this:
>
> web2py {
> server {
> listen 443;
> server_name server_domain_or_IP;
>
>
> root html;
> index index.html index.htm;
>
>
> ssl on;
> ssl_certificate /etc/nginx/ssl/myapp.crt;
> ssl_certificate_key /etc/nginx/ssl/myapp.key;
>
>
> ssl_session_timeout 5m;
>
>
> #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
> ssl_prefer_server_ciphers on;
>
>
> location / {
> include uwsgi_params;
> uwsgi_pass unix:/home/user/myapp/myapp.sock;
> }
> }
> }
>
> Also, you can look in the book:
>
>
> http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx
>
> There are good references there on how to setup nginx with uwsgi on ubuntu.
>
> -Jim
>
>
>
>
> On Monday, July 15, 2019 at 6:45:10 AM UTC-5, Maurice Waka wrote:
>>
>> I have a usual 'working' nginx file which works fine when being tested.
>>
>> The /etc/nginx/nginx.conf file
>>
>> user www-data;
>> worker_processes auto;
>> pid /run/nginx.pid;
>> include /etc/nginx/modules-enabled/*.conf;
>>
>>
>> events {
>> worker_connections 768;
>> # multi_accept on;
>> }
>>
>>
>> http {
>>
>>
>> ##
>> # Basic Settings
>> ##
>>
>>
>> sendfile on;
>> tcp_nopush on;
>> tcp_nodelay on;
>> tcp_nodelay on;
>> keepalive_timeout 65;
>> types_hash_max_size 2048;
>> # server_tokens off;
>>
>>
>> # server_names_hash_bucket_size 64;
>> # server_name_in_redirect off;
>>
>>
>> include /etc/nginx/mime.types;
>> default_type application/octet-stream;
>> ##
>> # SSL Settings
>> ##
>>
>>
>> ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
>> ssl_prefer_server_ciphers on;
>>
>>
>> ##
>> # Logging Settings
>> ##
>>
>>
>> access_log /var/log/nginx/access.log;
>> error_log /var/log/nginx/error.log;
>>
>>
>> ##
>> # Gzip Settings
>> ##
>>
>>
>> gzip on;
>>
>>
>> include /etc/nginx/conf.d/*.conf;
>> include /etc/nginx/sites-enabled/*;
>> }
>>
>>
>> But when edited with the server details below, I get this error nginx:
>> [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:90
>> nginx: configuration file /etc/nginx/nginx.conf test failed.
>>
>> How do I overcome this??
>>
>> server {
>> listen 443;
>> server_name server_domain_or_IP;
>>
>> root html;
>> index index.html index.htm;
>>
>> ssl on;
>> ssl_certificate /etc/nginx/ssl/myapp.crt;
>> ssl_certificate_key /etc/nginx/ssl/myapp.key;
>>
>> ssl_session_timeout 5m;
>>
>> #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
>> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
>> ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DE

[web2py] Why URL(..., scheme=True, ...) is implemented differently than request.is_https?

2019-07-16 Thread Ray (a.k.a. Iceberg)
Hi there,

I tend to use

URL(..., scheme=True, ...)

in my apps to generate an absolute URL, as documented here 
.

However, one of my app which has been deployed behind Apache wsgi with 
https, I noticed that the generated absolute URLs still use non-secure 
"http://...";.

It is said that there can be some special situation that the wsgi setting 
would be inaccurate 
.
 
However my question here for web2py is, why URL(..., scheme=True, ...) is 
implemented to depend on wsgi_url_scheme ONLY 
, 
while the is_https is more sophisticated 
? 
And, why does URL(..., scheme=True, ...) NOT depend on the more 
sophisticated is_https instead?

Regards,
Ray

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/274b4a55-3600-4b8b-ae86-c0dfd62e40bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: How to solve the Nginx error on digitalocean

2019-07-16 Thread Jim Steil
Did you take that server directive out of the nginx.conf file?

Jim


On Tue, Jul 16, 2019, 3:01 AM Maurice Waka  wrote:

> Used the link as you directed
>
> posted this:
> # file /etc/nginx/sites-available/web2py
> server {
> listen  80;
> server_name 165.22.57.107;
> #to enable correct use of response.static_version
> #location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
> #alias /web2py/applications/$1/static/$2;
> #expires max;
> #}
> location ~* /(\w+)/static/ {
> root /web2py/applications/;
> #remove next comment on production
> #expires max;
> }
> location / {
> #uwsgi_pass  127.0.0.1:8000;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> }
> }
> server {
> listen 443 default_server ssl;
> server_name 165.22.57.107;
> ssl_certificate /etc/nginx/ssl/web2py.crt;
> ssl_certificate_key /etc/nginx/ssl/web2py.key;
> ssl_prefer_server_ciphers on;
> ssl_session_cache shared:SSL:10m;
> ssl_session_timeout 10m;
> ssl_ciphers
> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
> ssl_protocols SSLv3 TLSv1;
> keepalive_timeout70;
> location / {
> #uwsgi_pass  127.0.0.1:9001;
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
> }
>
> }
>
>
> But got this error:
>
> nginx: [emerg] "server" directive is not allowed here in
> /etc/nginx/nginx.conf:86
>
>
> On Mon, Jul 15, 2019 at 4:39 PM Jim S  wrote:
>
>> I don't think server can be a root element in this file.  Do you have it
>> under another element?  I'd try it like this:
>>
>> web2py {
>> server {
>> listen 443;
>> server_name server_domain_or_IP;
>>
>>
>> root html;
>> index index.html index.htm;
>>
>>
>> ssl on;
>> ssl_certificate /etc/nginx/ssl/myapp.crt;
>> ssl_certificate_key /etc/nginx/ssl/myapp.key;
>>
>>
>> ssl_session_timeout 5m;
>>
>>
>> #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
>> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
>> ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
>> ssl_prefer_server_ciphers on;
>>
>>
>> location / {
>> include uwsgi_params;
>> uwsgi_pass unix:/home/user/myapp/myapp.sock;
>> }
>> }
>> }
>>
>> Also, you can look in the book:
>>
>>
>> http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
>> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx
>>
>> There are good references there on how to setup nginx with uwsgi on
>> ubuntu.
>>
>> -Jim
>>
>>
>>
>>
>> On Monday, July 15, 2019 at 6:45:10 AM UTC-5, Maurice Waka wrote:
>>>
>>> I have a usual 'working' nginx file which works fine when being tested.
>>>
>>> The /etc/nginx/nginx.conf file
>>>
>>> user www-data;
>>> worker_processes auto;
>>> pid /run/nginx.pid;
>>> include /etc/nginx/modules-enabled/*.conf;
>>>
>>>
>>> events {
>>> worker_connections 768;
>>> # multi_accept on;
>>> }
>>>
>>>
>>> http {
>>>
>>>
>>> ##
>>> # Basic Settings
>>> ##
>>>
>>>
>>> sendfile on;
>>> tcp_nopush on;
>>> tcp_nodelay on;
>>> tcp_nodelay on;
>>> keepalive_timeout 65;
>>> types_hash_max_size 2048;
>>> # server_tokens off;
>>>
>>>
>>> # server_names_hash_bucket_size 64;
>>> # server_name_in_redirect off;
>>>
>>>
>>> include /etc/nginx/mime.types;
>>> default_type application/octet-stream;
>>> ##
>>> # SSL Settings
>>> ##
>>>
>>>
>>> ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref:
>>> POODLE
>>> ssl_prefer_server_ciphers on;
>>>
>>>
>>> ##
>>> # Logging Settings
>>> ##
>>>
>>>
>>> access_log /var/log/nginx/access.log;
>>> error_log /var/log/nginx/error.log;
>>>
>>>
>>> ##
>>> # Gzip Settings
>>> ##
>>>
>>>
>>> gzip on;
>>>
>>>
>>> include /etc/nginx/conf.d/*.conf;
>>> include /etc/nginx/sites-enabled/*;
>>> }
>>>
>>>
>>> But when edited with the server details below, I get this error nginx:
>>> [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:90
>>> nginx: configuration file /etc/nginx/nginx.conf test failed.
>>>
>>> How do I overcome this??
>>>
>>> server {
>>> listen 443;
>>> server_name server_domain_or_IP;
>>>
>>> 

Re: [web2py] Re: How to solve the Nginx error on digitalocean

2019-07-16 Thread Maurice Waka
Nope. Web2py example

On Tue, 16 Jul 2019, 14:38 Jim Steil  wrote:

> Did you take that server directive out of the nginx.conf file?
>
> Jim
>
>
> On Tue, Jul 16, 2019, 3:01 AM Maurice Waka  wrote:
>
>> Used the link as you directed
>>
>> posted this:
>> # file /etc/nginx/sites-available/web2py
>> server {
>> listen  80;
>> server_name 165.22.57.107;
>> #to enable correct use of response.static_version
>> #location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
>> #alias /web2py/applications/$1/static/$2;
>> #expires max;
>> #}
>> location ~* /(\w+)/static/ {
>> root /web2py/applications/;
>> #remove next comment on production
>> #expires max;
>> }
>> location / {
>> #uwsgi_pass  127.0.0.1:8000;
>> uwsgi_pass  unix:///tmp/web2py.socket;
>> include uwsgi_params;
>> uwsgi_param UWSGI_SCHEME $scheme;
>> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>> }
>> }
>> server {
>> listen 443 default_server ssl;
>> server_name 165.22.57.107;
>> ssl_certificate /etc/nginx/ssl/web2py.crt;
>> ssl_certificate_key /etc/nginx/ssl/web2py.key;
>> ssl_prefer_server_ciphers on;
>> ssl_session_cache shared:SSL:10m;
>> ssl_session_timeout 10m;
>> ssl_ciphers
>> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
>> ssl_protocols SSLv3 TLSv1;
>> keepalive_timeout70;
>> location / {
>> #uwsgi_pass  127.0.0.1:9001;
>> uwsgi_pass  unix:///tmp/web2py.socket;
>> include uwsgi_params;
>> uwsgi_param UWSGI_SCHEME $scheme;
>> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>> }
>>
>> }
>>
>>
>> But got this error:
>>
>> nginx: [emerg] "server" directive is not allowed here in
>> /etc/nginx/nginx.conf:86
>>
>>
>> On Mon, Jul 15, 2019 at 4:39 PM Jim S  wrote:
>>
>>> I don't think server can be a root element in this file.  Do you have it
>>> under another element?  I'd try it like this:
>>>
>>> web2py {
>>> server {
>>> listen 443;
>>> server_name server_domain_or_IP;
>>>
>>>
>>> root html;
>>> index index.html index.htm;
>>>
>>>
>>> ssl on;
>>> ssl_certificate /etc/nginx/ssl/myapp.crt;
>>> ssl_certificate_key /etc/nginx/ssl/myapp.key;
>>>
>>>
>>> ssl_session_timeout 5m;
>>>
>>>
>>> #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
>>> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
>>> ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
>>> ssl_prefer_server_ciphers on;
>>>
>>>
>>> location / {
>>> include uwsgi_params;
>>> uwsgi_pass unix:/home/user/myapp/myapp.sock;
>>> }
>>> }
>>> }
>>>
>>> Also, you can look in the book:
>>>
>>>
>>> http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
>>> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx
>>>
>>> There are good references there on how to setup nginx with uwsgi on
>>> ubuntu.
>>>
>>> -Jim
>>>
>>>
>>>
>>>
>>> On Monday, July 15, 2019 at 6:45:10 AM UTC-5, Maurice Waka wrote:

 I have a usual 'working' nginx file which works fine when being tested.

 The /etc/nginx/nginx.conf file

 user www-data;
 worker_processes auto;
 pid /run/nginx.pid;
 include /etc/nginx/modules-enabled/*.conf;


 events {
 worker_connections 768;
 # multi_accept on;
 }


 http {


 ##
 # Basic Settings
 ##


 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 tcp_nodelay on;
 keepalive_timeout 65;
 types_hash_max_size 2048;
 # server_tokens off;


 # server_names_hash_bucket_size 64;
 # server_name_in_redirect off;


 include /etc/nginx/mime.types;
 default_type application/octet-stream;
 ##
 # SSL Settings
 ##


 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref:
 POODLE
 ssl_prefer_server_ciphers on;


 ##
 # Logging Settings
 ##


 access_log /var/log/nginx/access.log;
 error_log /var/log/nginx/error.log;


 ##
 # Gzip Settings
 ##


 gzip on;


 include /etc/nginx/conf.d/*.conf;
 include /etc/nginx/sites-enabled/*;
 }


 But when edited with the server details below, I get this error nginx:
 [e

Re: [web2py] Re: How to solve the Nginx error on digitalocean

2019-07-16 Thread Jim Steil
I would remove that and retry it.

On Tue, Jul 16, 2019 at 8:16 AM Maurice Waka  wrote:

> Nope. Web2py example
>
> On Tue, 16 Jul 2019, 14:38 Jim Steil  wrote:
>
>> Did you take that server directive out of the nginx.conf file?
>>
>> Jim
>>
>>
>> On Tue, Jul 16, 2019, 3:01 AM Maurice Waka  wrote:
>>
>>> Used the link as you directed
>>>
>>> posted this:
>>> # file /etc/nginx/sites-available/web2py
>>> server {
>>> listen  80;
>>> server_name 165.22.57.107;
>>> #to enable correct use of response.static_version
>>> #location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
>>> #alias /web2py/applications/$1/static/$2;
>>> #expires max;
>>> #}
>>> location ~* /(\w+)/static/ {
>>> root /web2py/applications/;
>>> #remove next comment on production
>>> #expires max;
>>> }
>>> location / {
>>> #uwsgi_pass  127.0.0.1:8000;
>>> uwsgi_pass  unix:///tmp/web2py.socket;
>>> include uwsgi_params;
>>> uwsgi_param UWSGI_SCHEME $scheme;
>>> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>>> }
>>> }
>>> server {
>>> listen 443 default_server ssl;
>>> server_name 165.22.57.107;
>>> ssl_certificate /etc/nginx/ssl/web2py.crt;
>>> ssl_certificate_key /etc/nginx/ssl/web2py.key;
>>> ssl_prefer_server_ciphers on;
>>> ssl_session_cache shared:SSL:10m;
>>> ssl_session_timeout 10m;
>>> ssl_ciphers
>>> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
>>> ssl_protocols SSLv3 TLSv1;
>>> keepalive_timeout70;
>>> location / {
>>> #uwsgi_pass  127.0.0.1:9001;
>>> uwsgi_pass  unix:///tmp/web2py.socket;
>>> include uwsgi_params;
>>> uwsgi_param UWSGI_SCHEME $scheme;
>>> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>>> }
>>>
>>> }
>>>
>>>
>>> But got this error:
>>>
>>> nginx: [emerg] "server" directive is not allowed here in
>>> /etc/nginx/nginx.conf:86
>>>
>>>
>>> On Mon, Jul 15, 2019 at 4:39 PM Jim S  wrote:
>>>
 I don't think server can be a root element in this file.  Do you have
 it under another element?  I'd try it like this:

 web2py {
 server {
 listen 443;
 server_name server_domain_or_IP;


 root html;
 index index.html index.htm;


 ssl on;
 ssl_certificate /etc/nginx/ssl/myapp.crt;
 ssl_certificate_key /etc/nginx/ssl/myapp.key;


 ssl_session_timeout 5m;


 #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
 ssl_prefer_server_ciphers on;


 location / {
 include uwsgi_params;
 uwsgi_pass unix:/home/user/myapp/myapp.sock;
 }
 }
 }

 Also, you can look in the book:


 http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
 http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx

 There are good references there on how to setup nginx with uwsgi on
 ubuntu.

 -Jim




 On Monday, July 15, 2019 at 6:45:10 AM UTC-5, Maurice Waka wrote:
>
> I have a usual 'working' nginx file which works fine when being tested.
>
> The /etc/nginx/nginx.conf file
>
> user www-data;
> worker_processes auto;
> pid /run/nginx.pid;
> include /etc/nginx/modules-enabled/*.conf;
>
>
> events {
> worker_connections 768;
> # multi_accept on;
> }
>
>
> http {
>
>
> ##
> # Basic Settings
> ##
>
>
> sendfile on;
> tcp_nopush on;
> tcp_nodelay on;
> tcp_nodelay on;
> keepalive_timeout 65;
> types_hash_max_size 2048;
> # server_tokens off;
>
>
> # server_names_hash_bucket_size 64;
> # server_name_in_redirect off;
>
>
> include /etc/nginx/mime.types;
> default_type application/octet-stream;
> ##
> # SSL Settings
> ##
>
>
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref:
> POODLE
> ssl_prefer_server_ciphers on;
>
>
> ##
> # Logging Settings
> ##
>
>
> access_log /var/log/nginx/access.log;
> error_log /var/log/nginx/error.log;
>
>
> ##
> # 

Re: [web2py] Re: please help testing web3py

2019-07-16 Thread Johann Spies
On Sun, 14 Jul 2019 at 05:48, Massimo Di Pierro 
wrote:

>
> I posted some preliminary documentation
> https://github.com/web2py/web3py/tree/master/apps/_documentation
>
>
>
I do not see a Makefile to convert the .mm-files to html-documentation. How
do I read the documentation?

Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGZ55DS7VO7Sm7RY5MwBwfMKi8bt9zyjNhuc3nGd4u%2BK1DJLpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: How to solve the Nginx error on digitalocean

2019-07-16 Thread Maurice Waka
removed, tried, restarted everything but errors still remains.
Modified it as you had suggested but the latest error:
nginx: [emerg] unknown directive "web2py" in /etc/nginx/nginx.conf:87

On Tue, Jul 16, 2019 at 4:28 PM Jim Steil  wrote:

> I would remove that and retry it.
>
> On Tue, Jul 16, 2019 at 8:16 AM Maurice Waka 
> wrote:
>
>> Nope. Web2py example
>>
>> On Tue, 16 Jul 2019, 14:38 Jim Steil  wrote:
>>
>>> Did you take that server directive out of the nginx.conf file?
>>>
>>> Jim
>>>
>>>
>>> On Tue, Jul 16, 2019, 3:01 AM Maurice Waka 
>>> wrote:
>>>
 Used the link as you directed

 posted this:
 # file /etc/nginx/sites-available/web2py
 server {
 listen  80;
 server_name 165.22.57.107;
 #to enable correct use of response.static_version
 #location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
 #alias /web2py/applications/$1/static/$2;
 #expires max;
 #}
 location ~* /(\w+)/static/ {
 root /web2py/applications/;
 #remove next comment on production
 #expires max;
 }
 location / {
 #uwsgi_pass  127.0.0.1:8000;
 uwsgi_pass  unix:///tmp/web2py.socket;
 include uwsgi_params;
 uwsgi_param UWSGI_SCHEME $scheme;
 uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
 }
 }
 server {
 listen 443 default_server ssl;
 server_name 165.22.57.107;
 ssl_certificate /etc/nginx/ssl/web2py.crt;
 ssl_certificate_key /etc/nginx/ssl/web2py.key;
 ssl_prefer_server_ciphers on;
 ssl_session_cache shared:SSL:10m;
 ssl_session_timeout 10m;
 ssl_ciphers
 ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
 ssl_protocols SSLv3 TLSv1;
 keepalive_timeout70;
 location / {
 #uwsgi_pass  127.0.0.1:9001;
 uwsgi_pass  unix:///tmp/web2py.socket;
 include uwsgi_params;
 uwsgi_param UWSGI_SCHEME $scheme;
 uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
 }

 }


 But got this error:

 nginx: [emerg] "server" directive is not allowed here in
 /etc/nginx/nginx.conf:86


 On Mon, Jul 15, 2019 at 4:39 PM Jim S  wrote:

> I don't think server can be a root element in this file.  Do you have
> it under another element?  I'd try it like this:
>
> web2py {
> server {
> listen 443;
> server_name server_domain_or_IP;
>
>
> root html;
> index index.html index.htm;
>
>
> ssl on;
> ssl_certificate /etc/nginx/ssl/myapp.crt;
> ssl_certificate_key /etc/nginx/ssl/myapp.key;
>
>
> ssl_session_timeout 5m;
>
>
> #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
> ssl_prefer_server_ciphers on;
>
>
> location / {
> include uwsgi_params;
> uwsgi_pass unix:/home/user/myapp/myapp.sock;
> }
> }
> }
>
> Also, you can look in the book:
>
>
> http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx
>
> There are good references there on how to setup nginx with uwsgi on
> ubuntu.
>
> -Jim
>
>
>
>
> On Monday, July 15, 2019 at 6:45:10 AM UTC-5, Maurice Waka wrote:
>>
>> I have a usual 'working' nginx file which works fine when being
>> tested.
>>
>> The /etc/nginx/nginx.conf file
>>
>> user www-data;
>> worker_processes auto;
>> pid /run/nginx.pid;
>> include /etc/nginx/modules-enabled/*.conf;
>>
>>
>> events {
>> worker_connections 768;
>> # multi_accept on;
>> }
>>
>>
>> http {
>>
>>
>> ##
>> # Basic Settings
>> ##
>>
>>
>> sendfile on;
>> tcp_nopush on;
>> tcp_nodelay on;
>> tcp_nodelay on;
>> keepalive_timeout 65;
>> types_hash_max_size 2048;
>> # server_tokens off;
>>
>>
>> # server_names_hash_bucket_size 64;
>> # server_name_in_redirect off;
>>
>>
>> include /etc/nginx/mime.types;
>> default_type application/octet-stream;
>> ##
>> 

Re: [web2py] Re: How to solve the Nginx error on digitalocean

2019-07-16 Thread Jim S
No, I'd just remove all of that completely.  This is my production 
nginx.conf file.  Also note the last 2 lines...

user www-data;
worker_processes auto;
pid /run/nginx.pid;


events {
 worker_connections 768;
 # multi_accept on;
}


http {


 ##
 # Basic Settings
 ##


 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout 65;
 types_hash_max_size 2048;
 # server_tokens off;


 # server_names_hash_bucket_size 64;
 # server_name_in_redirect off;


 include /etc/nginx/mime.types;
 default_type application/octet-stream;


 ##
 # SSL Settings
 ##


 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
 ssl_prefer_server_ciphers on;


 ##
 # Logging Settings
 ##


 access_log /var/log/nginx/access.log;
 error_log /var/log/nginx/error.log;


 ##
 # Gzip Settings
 ##


 gzip on;
 gzip_disable "msie6";


 # gzip_vary on;
 # gzip_proxied any;
 # gzip_comp_level 6;
 # gzip_buffers 16 8k;
 # gzip_http_version 1.1;
 # gzip_types text/plain text/css application/json application/javascript 
text/xml application/xml application/xml+rss text/javascript;


 ##
 # Virtual Host Configs
 ##


 include /etc/nginx/conf.d/*.conf;
 include /etc/nginx/sites-enabled/*;
}


-Jim


On Tuesday, July 16, 2019 at 8:16:57 AM UTC-5, Maurice Waka wrote:
>
> Nope. Web2py example 
>
> On Tue, 16 Jul 2019, 14:38 Jim Steil > 
> wrote:
>
>> Did you take that server directive out of the nginx.conf file?
>>
>> Jim
>>
>>
>> On Tue, Jul 16, 2019, 3:01 AM Maurice Waka > > wrote:
>>
>>> Used the link as you directed
>>>
>>> posted this:
>>> # file /etc/nginx/sites-available/web2py
>>> server {
>>> listen  80;
>>> server_name 165.22.57.107;
>>> #to enable correct use of response.static_version
>>> #location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
>>> #alias /web2py/applications/$1/static/$2;
>>> #expires max;
>>> #}
>>> location ~* /(\w+)/static/ {
>>> root /web2py/applications/;
>>> #remove next comment on production
>>> #expires max;
>>> }
>>> location / {
>>> #uwsgi_pass  127.0.0.1:8000;
>>> uwsgi_pass  unix:///tmp/web2py.socket;
>>> include uwsgi_params;
>>> uwsgi_param UWSGI_SCHEME $scheme;
>>> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>>> }
>>> }
>>> server {
>>> listen 443 default_server ssl;
>>> server_name 165.22.57.107;
>>> ssl_certificate /etc/nginx/ssl/web2py.crt;
>>> ssl_certificate_key /etc/nginx/ssl/web2py.key;
>>> ssl_prefer_server_ciphers on;
>>> ssl_session_cache shared:SSL:10m;
>>> ssl_session_timeout 10m;
>>> ssl_ciphers 
>>> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
>>> ssl_protocols SSLv3 TLSv1;
>>> keepalive_timeout70;
>>> location / {
>>> #uwsgi_pass  127.0.0.1:9001;
>>> uwsgi_pass  unix:///tmp/web2py.socket;
>>> include uwsgi_params;
>>> uwsgi_param UWSGI_SCHEME $scheme;
>>> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>>> }
>>>
>>> }
>>>
>>>
>>> But got this error:
>>>
>>> nginx: [emerg] "server" directive is not allowed here in 
>>> /etc/nginx/nginx.conf:86
>>>
>>>
>>> On Mon, Jul 15, 2019 at 4:39 PM Jim S > 
>>> wrote:
>>>
 I don't think server can be a root element in this file.  Do you have 
 it under another element?  I'd try it like this:

 web2py {
 server {
 listen 443;
 server_name server_domain_or_IP;


 root html;
 index index.html index.htm;


 ssl on;
 ssl_certificate /etc/nginx/ssl/myapp.crt;
 ssl_certificate_key /etc/nginx/ssl/myapp.key;


 ssl_session_timeout 5m;


 #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
 ssl_prefer_server_ciphers on;


 location / {
 include uwsgi_params;
 uwsgi_pass unix:/home/user/myapp/myapp.sock;
 }
 }
 }

 Also, you can look in the book:


 http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
 http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx

 There are good references there on how to setup nginx with uwsgi on 
 ubuntu.

 -Jim




 On Monday, July 15, 2019 at 6:45:10 AM UTC-5, Maurice Waka wrote:
>
> I have a usual 'working' nginx file which works fine when being tested.
>
> The /etc/nginx/nginx.conf file
>
> user www-data;
> worker_p

[web2py] Re: web2py scripts (homemade task queues) and python2 compatibility

2019-07-16 Thread Leonel Câmara
You're right, you must use the print function because web2py now has a "from 
__future__ import print_function" which forces you to use the print 
function even in python2

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/aaa778da-fcee-41a9-87fc-6efb45093413%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py scripts (homemade task queues) and python2 compatibility

2019-07-16 Thread Tom Clerckx
That's clear, thanks for the update.

On Tuesday, July 16, 2019 at 6:48:41 PM UTC+2, Leonel Câmara wrote:
>
> You're right, you must use the print function because web2py now has a "
> from __future__ import print_function" which forces you to use the print 
> function even in python2
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c3d5b073-7ea9-4f03-9e3d-fba8b9c329af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Why URL(..., scheme=True, ...) is implemented differently than request.is_https?

2019-07-16 Thread Paco Bernal
You can always redirect apache from http to https

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/eac9e3f1-f470-4cfe-8637-92b538477ec0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.