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_SOFTWARE    nginx/$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_timeout    70;
        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_SOFTWARE    nginx/$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 <ato.st...@gmail.com> 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:!3DES";
>>     ssl_prefer_server_ciphers on;
>>
>>     location / {
>>         include uwsgi_params;
>>         uwsgi_pass unix:/home/user/myapp/myapp.sock;
>>     }
>> }
>>
>>
>>
>> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/rEu_Yc91LVY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/d88f1ae3-40aa-44ac-a365-7b97995b81da%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/d88f1ae3-40aa-44ac-a365-7b97995b81da%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALkNK54HKGdrtSW9M9DZdXn4d5ugj1dD9oOJqSyNF0r%3DTY5tMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to