Running ownCloud3 On Nginx (LEMP) On Debian Squeeze/Ubuntu 11.10

Discussion in 'HOWTO-Related Questions' started by Lewy1, Feb 12, 2012.

  1. Lewy1

    Lewy1 New Member

    First of all, I'd like to thank you for your great tutorials on installing Nginx and Owncloud!
    Now for my question:
    In your tutorial for installing Owncloud you use www.example.com. Is that just an example or what should really be used. Also being that I'm setting this up on a Pogoplug running Debian Squeeze and only want to access it from the LAN (or from WAN via OpenVPN), is there no way to just access it by typing in the ip address of the Pogoplug? Why is the domain name needed?
    Thanks
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Yes. You should use your own domain name here.

    You can use
    Code:
    server_name _;
    in the vhost which makes it the default vhost (which means you can use the IP), but make sure that this is the only vhost that uses
    Code:
    server_name _;
    .
     
  3. Lewy1

    Lewy1 New Member

    Thanks for the reply. Sorry for all the questions but I'm a total noob! Assuming I use server_name _; The ownclowd should be installed in the /var/www directory with no sub directory by changing the following from your tutorial:

    Code:
    mv * /var/www/www.example.com/web/
    mv .htaccess /var/www/www.example.com/web/
    to
    Code:
    mv * /var/www
    mv .htaccess /var/www
    correct?
    Also, in your guide you wrote how to edit the vhost file with the following
    Code:
    server {
           listen 80;
           server_name www.example.com example.com;
           root /var/www/www.example.com/web;
    
           if ($http_host != "www.example.com") {
                     rewrite ^ http://www.example.com$request_uri permanent;
           }
    
           # This is to avoid a "Request Entity Too Large" error
           client_max_body_size 1000M;
           index index.php index.html index.htm;
    
           dav_methods PUT DELETE MKCOL COPY MOVE;
           create_full_put_path on;
           dav_access user:rw group:rw all:r;
    
           location = /favicon.ico {
                    log_not_found off;
                    access_log off;
                    expires max;
           }
    
           location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
           }
    
           # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
           location ~ /\. {
                    deny all;
                    access_log off;
                    log_not_found off;
           }
    
           location / {
                    index index.php;
                    try_files $uri $uri/ @webdav;
           }
    
           location @webdav {
                    fastcgi_split_path_info ^(.+.php)(/.+)$;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include /etc/nginx/fastcgi_params;
                    #fastcgi_param HTTPS on;
                    fastcgi_pass 127.0.0.1:9000;
           }
    
           location ~ \.php$ {
                    try_files $uri =404;
                    include /etc/nginx/fastcgi_params;
                    fastcgi_pass 127.0.0.1:9000;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_index index.php;
           }
    }
    How exactly do I change that based on my setup? I assume that I should just add the applicable parts to the default file in /etc/nginx/sites-available directory, but I don't really know what I'm doing!

    Thank you very much for your help and patience.
     
    Last edited: Feb 13, 2012
  4. falko

    falko Super Moderator ISPConfig Developer

    Yes.

    Just change
    Code:
    root /var/www/www.example.com/web;
    to
    Code:
    root /var/www;
     
  5. Lewy1

    Lewy1 New Member

    I'm really sorry:( for bugging you about this but I still don't have things clear.:confused:
    1. I should be doing this to the default file in sites-available?
    2. As of now, the default file has been edited based on your guide to installing nginx on debian squeeze. Am I adding things or replacing everything there. I'm really unclear about this. Sorry!
    3. You mentioned changing root /var/www/www.example.com/web; to root /var/www;, I assume I should also remove
    Code:
    if ($http_host != "www.example.com") {
                     rewrite ^ http://www.example.com$request_uri permanent;
           }
    Attached is my Default file.
     

    Attached Files:

    Last edited: Feb 14, 2012
  6. falko

    falko Super Moderator ISPConfig Developer

    You can either use the default vhost and adjust it, or you remove the default vhost according to the ownCloud tutorial (with the changes outlined in this thread).

    If you don't want the redirect, you can remove it. Otherwise all requests will be redirected to www.example.com.
     
  7. Lewy1

    Lewy1 New Member

    Thanks, all the help is appreciated.
     

Share This Page