Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VPS set up with php-fpm and nginx (with ssl). I have set up Tiny Tiny RSS already, and it works just fine. However, I recently attempted to set up Owncloud, and instantly hit a roadblock.

I visited the index page to do the initial set up, and there was absolutely no styling at all. I looked in Firefox's console, and saw several 404 errors. Looking closely, I saw that all the paths to the assets were wrong. Instead of requesting http://mydomain.com/owncloud/some/important/component.js, it requested http://mydomain.com/usr/share/nginx/html/owncloud/some/important/component.js.

It would seem that php is doing something wrong when it's processing the pages. I don't have this problem with Tiny Tiny RSS, so I would assume it has something to do with the way Owncloud was written.

I'm assuming there's a php.ini key I have to change. Any ideas?

The following is the content of my server block:

            listen 443 ssl;
            ssl_certificate /var/ssl/secret/sauce.key
            ssl_certificate_key /var/ssl/secret/sauce.key;
            server_name localhost 127.0.0.1 mydomain.com;
            root /usr/share/nginx/html;
            index index.html index.htm index.php;
            client_max_body_size 1000M;

            location / {
                    try_files $uri $uri/ @webdav =404;
            }

            location ~ \.php$ { 
                    include fastcgi_params;
                    fastcgi_index index.php;
                    try_files $1 = 404;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param HTTPS on;
                    fastcgi_pass 127.0.0.1:9000;
            }

            location ~ ^/owncloud/(data|config|\.ht|db_structure\.xml|README) {
                    deny all;
            }

            location @webdav {
                    fastcgi_split_path_info ^(.+\.php)(/.*)$;
                    fastcgi_pass 127.0.0.1:9000;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param HTTPS on;
                    include fastcgi_params;
            }

I realise that this isn't the complete configuration that the Owncloud documentation recommends, but I generally like to get a minimal working configuration and work up in order to learn how everything works. Reviewing the configuration options I left out, there didn't seem to be any that affected php processing, so I'm assuming it's fine. Otherwise, I would like to know what nginx directive I'm missing and why it's important.

share|improve this question
    
Did you create a virtual server for owncloud? –  Mohammad AbuShady Jan 2 at 10:32
    
is owncloud installed under /usr/share/nginx/html/owncloud ? –  Mohammad AbuShady Jan 7 at 23:07
    
Yes. XD The PHP file itself loads just fine, but is is unusable because it is not loading any js, css, etc. because it is referencing the wrong paths. –  MetaNova Jan 7 at 23:28
    
well your nginx config seems fine to me, maybe there's something in the owncloud config it self? idk –  Mohammad AbuShady Jan 8 at 8:56
    
I'm just using the default config supplied by Owncloud which later gets edited by the set up process. I imagine that the issue has something to do with the variable that represents the document root in Owncloud's PHP and the way my PHP is configured to handle that variable. –  MetaNova Jan 10 at 14:28

2 Answers 2

I'm assuming there's a php.ini key I have to change. Any ideas?

No, your application is likely configured wrong - Owncloud's PHP is generating those paths. Make sure you configured the URL path correctly in Owncloud.

share|improve this answer
    
According to the Owncloud docs, I shouldn't have to do anything other than set up php and untar the archive. –  MetaNova Jan 1 at 19:29
    
I have used Owncloud before with a similar setup without issue. Owncloud 5 also has the same issue (I've been using Owncloud 6) –  MetaNova Jan 2 at 2:41

Create a new virtual host for owncloud, and just edit the root and the upstream (either sock or port ), I already have a functioning owncloud server and it works fine.

Nginx configuration for owncloud

replace the root line and server in the upstream

I'm assuming you know how to create a virtual server, if not tell me so I could provide an explanation for that too.

EDIT

About ssl, one IP, and one virtual server:

Not really, It depends on what your ssl was bought for, if it's a single domain ssl like for example example.com or store.example.com, you can have as many sites as wanted on the same IP but the SSL will only be valid for that one domain you bought it for, unless you bought a wild card SSL, in that case it might support *.example.com

anyways, too have SSL on my server and it's only for domain.com and www.domain.com, I used it on my cloud server which was hosted on cloud.domain.com the only downside for it is that you get that yellow page warning because the domain isn't matching the one the ssl was bought for, I tell the browser to ignore that warning and save the exception and that's it, also the same for the sync client, it told me if i want to ignore the warning or not and it works just fine.

If you don't want to face that warning then yes you need to create the own cloud server under the same virtual host, not because of the IP, but because the name that the ssl was bought for.

Tell me which do you want and I'll help you with either.

share|improve this answer
    
This question assumes that "virtual server" means the same thing as virtual host or an nginx server block. What is the reasoning for having a separate server block for owncloud? The reason I wanted to have Tiny Tiny RSS and Owncloud under the same server block/virtual server is because I wanted to avoid issues with SSL, as I want both to be encrypted, and what I understand about SSL does not allow separate virtual websites to exist on the same IP address. –  MetaNova Jan 6 at 0:26
    
check my edited answer, and yes i meant virtual host not virtual server, that was a mistake –  Mohammad AbuShady Jan 6 at 7:54
    
I imagine that there are multiple solutions. I've created my own CA, as I don't want to deal with the browser-freakouts from self-signed certs and the cost of "official" certificates. Plus, this is just for my personal use, so I don't mind having to install the cert. I would like to keep it under the same virtual host, so I don't have to touch anything else, but if it would be easier to generate my own wildcard cert I can do that to. I mainly want to know why the paths would be wrong like that. –  MetaNova Jan 7 at 3:21
    
so are you going to use a subfolder, or what ? –  Mohammad AbuShady Jan 7 at 11:01
    
Yes. Like the urls above, I have it setup as /owncloud –  MetaNova Jan 7 at 15:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.