Skip to content

Help in configuration with Nginx (and Owncloud) #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pihomeserver opened this issue Aug 28, 2016 · 0 comments
Open

Help in configuration with Nginx (and Owncloud) #40

pihomeserver opened this issue Aug 28, 2016 · 0 comments

Comments

@pihomeserver
Copy link

Hello,

I installed Owncloud on a VPS with Nginx and php-fpm
Now i would like to link my Hubic account inside Owncloud using the openstack interface that's why i would like to use the gateway.
Unfortunaltly i don't know how to use/configure it. Owncloud is installed at the root of one of my subdomain. The gateway (simple.php) is in a subfolder called hubic. Another subfolder called cache has been created with config.php at the root path.

When i try to access the register part i got a 404 error code

Here is my nginx configuration (with a dedicated block for /hubic)

server {
    listen 80;
    listen [::]:80;
    server_name cloud.mysubdomain.fr;
    return 301 https://$server_name$request_uri;
}

server {
        server_name cloud.mysubdomain.fr;

        listen 443 ssl;
        listen [::]:443 ssl;
        include snippets/ssl-cloud.mysubdomain.fr.conf;
        include snippets/ssl-params.conf;

        index index.php;
        root /var/www/cloud;

        # set max upload size
        client_max_body_size 10G;
        fastcgi_buffers 64 4K;

        # Disable gzip to avoid the removal of the ETag header
        gzip off;

    rewrite ^/caldav((/|$).*)$ /remote.php/caldav$1 last;
    rewrite ^/carddav((/|$).*)$ /remote.php/carddav$1 last;
    rewrite ^/webdav((/|$).*)$ /remote.php/webdav$1 last;

    error_page 403 = /core/templates/403.php;
    error_page 404 = /core/templates/404.php;

    location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }

        location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
                deny all;
        }

        location / {
                # The following 2 rules are only needed with webfinger
                rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
                rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

                rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
                rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;

                rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;

                try_files $uri $uri/ index.php;
        }

        location ~ \.php(?:$|/) {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param HTTPS on;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
        }

        location /hubic {
                index simple.php;
                rewrite ^/(.*)$ /simple.php?/$1 last;
                root /var/www/cloud/hubic;
                try_files $uri $uri/ /simple.php?$args;
        }

        # Adding the cache control header for js and css files
        # Make sure it is BELOW the location ~ \.php(?:$|/) { block
        location ~* \.(?:css|js)$ {
                add_header Cache-Control "public, max-age=7200";
                # Add headers to serve security related headers
                add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
                add_header X-Content-Type-Options nosniff;
                add_header X-Frame-Options "SAMEORIGIN";
                add_header X-XSS-Protection "1; mode=block";
                add_header X-Robots-Tag none;
                # Optional: Don't log access to assets
                access_log off;
        }    

        # Optional: set long EXPIRES header on static assets
        location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
                expires 30d;
                # Optional: Don't log access to assets
                access_log off;
        }
}

Any help is welcome.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant