nginx "spdy" error

Aaron W Floch

New Member


Messages: 3

I am following Joshua's guide to install owncloud in a jail. I am having consistent issues with the nginx.conf file. Originally, I posted in the FreeNAS forum specific to the owncloud jail: https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/page-38#post-239496
I was told to come here. Below I will post what I have in my nginx.conf file so I might get some help. When I run service nginx reload I get this error:
Code:
nginx: [emerg] the "spdy" parameter requires ngx_http_spdy_module in /usr/local/etc/nginx/nginx.conf:21
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
I appreciate any help.

Code:
worker_processes 2;

events {
    worker_connections  1024;
}

http {
    include      mime.types;
    default_type  application/octet-stream;
    sendfile        off;
    keepalive_timeout  65;
    gzip off;

    server {
       listen 80;
       server_name www.yourdomain.com yourdomain.com;
       return  301 https://$server_name$request_uri;
    }

    server {
        listen 443 spdy;
        server_name www.yourdomain.com yourdomain.com;
        root /usr/local/www;
        location = /robots.txt { allow all; access_log off; log_not_found off; }
        location = /favicon.ico { access_log off; log_not_found off; }
        location ^~ /owncloud {
            index index.php;
            try_files $uri $uri/ /owncloud/index.php$is_args$args;
            client_max_body_size 512M;
            location ^/owncloud/(?:\.|data|config|db_structure\.xml|README) {
                deny all;
            }
            location \.php(?:$|/) {
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                fastcgi_pass unix:/var/run/php-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                include fastcgi_params;
                fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
            }
            location  \.(?:jpg|gif|ico|png|css|js|svg)$ {
                expires 30d; add_header Cache-Control public;
            }
            location ^/owncloud/data {
                internal;
                alias /mnt/files;
            }
        }
    }
}
 
OP
OP
A

Aaron W Floch

New Member


Messages: 3

Okay, I deleted spdy after 443 and things seem to work. Will this somehow effect SSL certification in anyway?
 

ondra_knezour

Aspiring Daemon

Reaction score: 196
Messages: 761

Your nginx is probably built without the SPDY module. Try to change
Code:
listen 443 spdy
to
Code:
listen 443 ssl
. However I don't see any certificate configuration in your example, so expect additional errors if you didn't define it elsewhere.
 

drhowarddrfine

Son of Beastie

Reaction score: 1,198
Messages: 3,176

My line for listen is
Code:
listen 443 ssl spdy
Or it was until I switched to http2. Your sendfile should be 'on', too.

Nginx only serves static files, not dynamic. I see your index file is index.php but what runs that? In my case, I have to use php-fpm or fastcgi or, in the case of Javascript, proxy it to node.js or, in Go, the built-in server or, in C, another server altogether.
 
Last edited by a moderator:
OP
OP
A

Aaron W Floch

New Member


Messages: 3

Since I have posted this I have found out that I was using the wrong nginx.conf. There was a guide on Github.com that showed how to install Owncloud in a jail. However, I found out that there is an updated version on the FreeNAS forum. This new nginx.conf looks a lot different and I have things "working" now.

Your nginx is probably built without the SPDY module. Try to change
This is correct. I removed SPDY and things "work" now. I really appreciate the response.

Nginx only serves static files, not dynamic. I see your index file is index.php but what runs that? In my case, I have to use php-fpm or fastcgi or, in the case of Javascript, proxy it to node.js or, in Go, the built-in server or, in C, another server altogether.
I am assuming php-fpm. Like I mentioned in the first paragraph, I used the wrong nginx.conf information. It is updated now. However, the sendfile is still off. Still, this is specific for the Owncloud jail, so Joshua, the person that built the guide must have it that way for a reason. Unless it is to deter extreme noobies like myself. Which may be why I still haven't gotten it to work.

Thanks for the response, it was helpful.

SPDY supported was removed upstream in new Nginx releases to make way for HTTP/2.0. In other words, don't use the option unless you know why you've enabled it.
That makes sense. Removing that from the .conf made it work. Cyberjock over on FreeNAS forums has a guide to install SSL in a jail. I am going to follow that, so hopefully things work out.

Thanks.
 

drhowarddrfine

Son of Beastie

Reaction score: 1,198
Messages: 3,176

However, the sendfile is still off. Still, this is specific for the Owncloud jail, so Joshua, the person that built the guide must have it that way for a reason.
That is a FreeBSD specific setting for improved disk I/O but doesn't help Linux ... I think ... and needs to be off for them. It's one of those settings I knew everything about till someone brings it up later and then I don't remember anything at all.
 

junovitch@

Daemon
Developer

Reaction score: 616
Messages: 1,773

That is a FreeBSD specific setting for improved disk I/O but doesn't help Linux ... I think ... and needs to be off for them. It's one of those settings I knew everything about till someone brings it up later and then I don't remember anything at all.
It allows sending a file directly over network socket without the overhead of copying it to the application and the application copying it back to the kernel to go out over a network socket. It's also implemented on both Linux and FreeBSD.
Linux: sendfile(2)
FreeBSD: sendfile(2)
 

drhowarddrfine

Son of Beastie

Reaction score: 1,198
Messages: 3,176

junovitch@ Then there's something I'm mis-remembering but I know it's best to have it set on for FreeBSD but it's off by default (for everyone else?) I just don't remember the reasons.
 
Top