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 the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/d88f1ae3-40aa-44ac-a365-7b97995b81da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.