Dokuwiki farm on nginx, using subdomains












0














I installed dokuwiki and the farmer plugin today on my webserver running Nginx. Unfortunately, all of the documentation is for Apache, and i'm not good enough with figuring this stuff out to get this on my own. Scoured the web and all i've found is a question asking about using URL rewriting after the FQDN. My want is to setup the farm to build each child under sub.domain.com, so wiki.sub.domain.com. I feel like this shouldn't be as hard as it's proving to be, but... As it stands, the plugin does correctly build the subdomain address, but it doesn't properly direct. i have a server block in sites-available that does the normal redirecting, providing access to the farmer. So the question, given https://www.dokuwiki.org/farms and https://www.dokuwiki.org/plugin:farmer , is how to correctly build the server block with *.sub.domain.com as the FQDN built by the plugin? What do i need to put in for redirecting or rewriting? i have a DNS A entry with *.sub that i'm pretty sure should properly point, but i know it won't work without the rewriting.



server {
#listen 80;
#listen [::]:80;

listen 443 ssl;
listen [::]:443 ssl;

ssl_certificate /path/to.crt;
ssl_certificate_key /path/to.key;

ssl_ciphers HIGH:!aNULL:!MD5;

root /path/to/root/html;

server_name sub.domain.com;

index doku.php;

client_max_body_size 1024M;
client_body_timeout 60;

#Support for X-Accel-Redirect
location ~ ^/data/ { internal ; }

location ~ ^/lib.*.(js|css|gif|png|ico|jpg|jpeg)$ {
expires 365d;
}

location / { try_files $uri $uri/ @dokuwiki; }

location @dokuwiki {
# rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
rewrite ^/(.*) /doku.php?id=$1&$args last;
}

location ~ .php$ {
try_files $uri $uri/ /doku.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

}

location ~ /(conf|bin|inc)/ { deny all; }
location ~ /install.php { deny all; }
location ~ /data/ { internal; }
}


Anybody got any ideas? i don't know where to start at this point.










share|improve this question



























    0














    I installed dokuwiki and the farmer plugin today on my webserver running Nginx. Unfortunately, all of the documentation is for Apache, and i'm not good enough with figuring this stuff out to get this on my own. Scoured the web and all i've found is a question asking about using URL rewriting after the FQDN. My want is to setup the farm to build each child under sub.domain.com, so wiki.sub.domain.com. I feel like this shouldn't be as hard as it's proving to be, but... As it stands, the plugin does correctly build the subdomain address, but it doesn't properly direct. i have a server block in sites-available that does the normal redirecting, providing access to the farmer. So the question, given https://www.dokuwiki.org/farms and https://www.dokuwiki.org/plugin:farmer , is how to correctly build the server block with *.sub.domain.com as the FQDN built by the plugin? What do i need to put in for redirecting or rewriting? i have a DNS A entry with *.sub that i'm pretty sure should properly point, but i know it won't work without the rewriting.



    server {
    #listen 80;
    #listen [::]:80;

    listen 443 ssl;
    listen [::]:443 ssl;

    ssl_certificate /path/to.crt;
    ssl_certificate_key /path/to.key;

    ssl_ciphers HIGH:!aNULL:!MD5;

    root /path/to/root/html;

    server_name sub.domain.com;

    index doku.php;

    client_max_body_size 1024M;
    client_body_timeout 60;

    #Support for X-Accel-Redirect
    location ~ ^/data/ { internal ; }

    location ~ ^/lib.*.(js|css|gif|png|ico|jpg|jpeg)$ {
    expires 365d;
    }

    location / { try_files $uri $uri/ @dokuwiki; }

    location @dokuwiki {
    # rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
    rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
    rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
    rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
    rewrite ^/(.*) /doku.php?id=$1&$args last;
    }

    location ~ .php$ {
    try_files $uri $uri/ /doku.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param REDIRECT_STATUS 200;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

    }

    location ~ /(conf|bin|inc)/ { deny all; }
    location ~ /install.php { deny all; }
    location ~ /data/ { internal; }
    }


    Anybody got any ideas? i don't know where to start at this point.










    share|improve this question

























      0












      0








      0







      I installed dokuwiki and the farmer plugin today on my webserver running Nginx. Unfortunately, all of the documentation is for Apache, and i'm not good enough with figuring this stuff out to get this on my own. Scoured the web and all i've found is a question asking about using URL rewriting after the FQDN. My want is to setup the farm to build each child under sub.domain.com, so wiki.sub.domain.com. I feel like this shouldn't be as hard as it's proving to be, but... As it stands, the plugin does correctly build the subdomain address, but it doesn't properly direct. i have a server block in sites-available that does the normal redirecting, providing access to the farmer. So the question, given https://www.dokuwiki.org/farms and https://www.dokuwiki.org/plugin:farmer , is how to correctly build the server block with *.sub.domain.com as the FQDN built by the plugin? What do i need to put in for redirecting or rewriting? i have a DNS A entry with *.sub that i'm pretty sure should properly point, but i know it won't work without the rewriting.



      server {
      #listen 80;
      #listen [::]:80;

      listen 443 ssl;
      listen [::]:443 ssl;

      ssl_certificate /path/to.crt;
      ssl_certificate_key /path/to.key;

      ssl_ciphers HIGH:!aNULL:!MD5;

      root /path/to/root/html;

      server_name sub.domain.com;

      index doku.php;

      client_max_body_size 1024M;
      client_body_timeout 60;

      #Support for X-Accel-Redirect
      location ~ ^/data/ { internal ; }

      location ~ ^/lib.*.(js|css|gif|png|ico|jpg|jpeg)$ {
      expires 365d;
      }

      location / { try_files $uri $uri/ @dokuwiki; }

      location @dokuwiki {
      # rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
      rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
      rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
      rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
      rewrite ^/(.*) /doku.php?id=$1&$args last;
      }

      location ~ .php$ {
      try_files $uri $uri/ /doku.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param REDIRECT_STATUS 200;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

      }

      location ~ /(conf|bin|inc)/ { deny all; }
      location ~ /install.php { deny all; }
      location ~ /data/ { internal; }
      }


      Anybody got any ideas? i don't know where to start at this point.










      share|improve this question













      I installed dokuwiki and the farmer plugin today on my webserver running Nginx. Unfortunately, all of the documentation is for Apache, and i'm not good enough with figuring this stuff out to get this on my own. Scoured the web and all i've found is a question asking about using URL rewriting after the FQDN. My want is to setup the farm to build each child under sub.domain.com, so wiki.sub.domain.com. I feel like this shouldn't be as hard as it's proving to be, but... As it stands, the plugin does correctly build the subdomain address, but it doesn't properly direct. i have a server block in sites-available that does the normal redirecting, providing access to the farmer. So the question, given https://www.dokuwiki.org/farms and https://www.dokuwiki.org/plugin:farmer , is how to correctly build the server block with *.sub.domain.com as the FQDN built by the plugin? What do i need to put in for redirecting or rewriting? i have a DNS A entry with *.sub that i'm pretty sure should properly point, but i know it won't work without the rewriting.



      server {
      #listen 80;
      #listen [::]:80;

      listen 443 ssl;
      listen [::]:443 ssl;

      ssl_certificate /path/to.crt;
      ssl_certificate_key /path/to.key;

      ssl_ciphers HIGH:!aNULL:!MD5;

      root /path/to/root/html;

      server_name sub.domain.com;

      index doku.php;

      client_max_body_size 1024M;
      client_body_timeout 60;

      #Support for X-Accel-Redirect
      location ~ ^/data/ { internal ; }

      location ~ ^/lib.*.(js|css|gif|png|ico|jpg|jpeg)$ {
      expires 365d;
      }

      location / { try_files $uri $uri/ @dokuwiki; }

      location @dokuwiki {
      # rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
      rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
      rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
      rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
      rewrite ^/(.*) /doku.php?id=$1&$args last;
      }

      location ~ .php$ {
      try_files $uri $uri/ /doku.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param REDIRECT_STATUS 200;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

      }

      location ~ /(conf|bin|inc)/ { deny all; }
      location ~ /install.php { deny all; }
      location ~ /data/ { internal; }
      }


      Anybody got any ideas? i don't know where to start at this point.







      nginx dokuwiki






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 28 '18 at 8:59









      kitkatkitkat

      12




      12






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You need to understand how DokuWiki handle animals.



          For creating an animal at animal.sub.domain.com,



          You need to define the settings Base Domain for subdomain Animals in farming/configuration as sub.domain.com.



          Next, Add a new animal



          Define the Animal Name / Domain as animal1



          Now, Dokuwiki points the animal1 to animal1.sub.domain.com



          I tested this on a nginx server, it points to the domain correctly.



          Additionally, if you are using SSL, you should redirect your http server to https for security purpose.



          server {
          listen 80;
          server_name sub.domain.com;
          return 301 https://$host$request_uri;
          }


          My sub.domain.com.confnginx settings are below.
          It also includes the location blocks for handling nice url rewrites.



          server {
          listen 80;
          server_name sub.domain.com;
          return 301 https://$host$request_uri;
          autoindex off;
          }

          # For ssl
          server {
          ssl on;
          ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem;
          ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem;
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_prefer_server_ciphers on;
          ssl_dhparam /etc/ssl/certs/dhparam.pem;
          ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
          ssl_session_timeout 1d;
          ssl_session_cache shared:SSL:50m;
          ssl_stapling on;
          ssl_stapling_verify on;
          add_header Strict-Transport-Security max-age=15768000;
          client_max_body_size 20M;
          client_body_buffer_size 128k;
          default_type application/octet-stream;

          listen 443;
          server_name sub.domain.com;

          root /var/www/html/wiki;

          # For ACME challenge
          location ~ /.well-known {
          allow all;
          }

          location ~ ^/! {
          rewrite ^/!(.*?)/(.*) /$2?$args&animal=$1 last;
          rewrite ^/!(.*)$ /?animal=$1 last;

          }


          location / {
          index doku.php;
          try_files $uri $uri/ @dokuwiki;

          }

          location ~ ^/lib.*.(gif|png|ico|jpg)$ {
          expires 30d;
          }


          location ~ /farm {
          index doku.php;
          autoindex on;
          rewrite ^/farm/?([^/]+)/(.*) /wiki/$2?animal=$1;
          rewrite ^/farm/?([^/]+)$ /wiki/?animal=$1;

          }


          location @dokuwiki {
          rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
          rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
          rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
          rewrite ^/(.*) /doku.php?id=$1&$args last;

          }

          location ~ .php$ {
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_pass unix:/run/php/php7.0-fpm.sock;
          }

          location ~ /(data|conf|bin|inc)/ {
          deny all;
          }


          }





          share|improve this answer








          New contributor




          Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388360%2fdokuwiki-farm-on-nginx-using-subdomains%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You need to understand how DokuWiki handle animals.



            For creating an animal at animal.sub.domain.com,



            You need to define the settings Base Domain for subdomain Animals in farming/configuration as sub.domain.com.



            Next, Add a new animal



            Define the Animal Name / Domain as animal1



            Now, Dokuwiki points the animal1 to animal1.sub.domain.com



            I tested this on a nginx server, it points to the domain correctly.



            Additionally, if you are using SSL, you should redirect your http server to https for security purpose.



            server {
            listen 80;
            server_name sub.domain.com;
            return 301 https://$host$request_uri;
            }


            My sub.domain.com.confnginx settings are below.
            It also includes the location blocks for handling nice url rewrites.



            server {
            listen 80;
            server_name sub.domain.com;
            return 301 https://$host$request_uri;
            autoindex off;
            }

            # For ssl
            server {
            ssl on;
            ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_prefer_server_ciphers on;
            ssl_dhparam /etc/ssl/certs/dhparam.pem;
            ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
            ssl_session_timeout 1d;
            ssl_session_cache shared:SSL:50m;
            ssl_stapling on;
            ssl_stapling_verify on;
            add_header Strict-Transport-Security max-age=15768000;
            client_max_body_size 20M;
            client_body_buffer_size 128k;
            default_type application/octet-stream;

            listen 443;
            server_name sub.domain.com;

            root /var/www/html/wiki;

            # For ACME challenge
            location ~ /.well-known {
            allow all;
            }

            location ~ ^/! {
            rewrite ^/!(.*?)/(.*) /$2?$args&animal=$1 last;
            rewrite ^/!(.*)$ /?animal=$1 last;

            }


            location / {
            index doku.php;
            try_files $uri $uri/ @dokuwiki;

            }

            location ~ ^/lib.*.(gif|png|ico|jpg)$ {
            expires 30d;
            }


            location ~ /farm {
            index doku.php;
            autoindex on;
            rewrite ^/farm/?([^/]+)/(.*) /wiki/$2?animal=$1;
            rewrite ^/farm/?([^/]+)$ /wiki/?animal=$1;

            }


            location @dokuwiki {
            rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
            rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
            rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
            rewrite ^/(.*) /doku.php?id=$1&$args last;

            }

            location ~ .php$ {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            }

            location ~ /(data|conf|bin|inc)/ {
            deny all;
            }


            }





            share|improve this answer








            New contributor




            Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.























              0














              You need to understand how DokuWiki handle animals.



              For creating an animal at animal.sub.domain.com,



              You need to define the settings Base Domain for subdomain Animals in farming/configuration as sub.domain.com.



              Next, Add a new animal



              Define the Animal Name / Domain as animal1



              Now, Dokuwiki points the animal1 to animal1.sub.domain.com



              I tested this on a nginx server, it points to the domain correctly.



              Additionally, if you are using SSL, you should redirect your http server to https for security purpose.



              server {
              listen 80;
              server_name sub.domain.com;
              return 301 https://$host$request_uri;
              }


              My sub.domain.com.confnginx settings are below.
              It also includes the location blocks for handling nice url rewrites.



              server {
              listen 80;
              server_name sub.domain.com;
              return 301 https://$host$request_uri;
              autoindex off;
              }

              # For ssl
              server {
              ssl on;
              ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem;
              ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem;
              ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
              ssl_prefer_server_ciphers on;
              ssl_dhparam /etc/ssl/certs/dhparam.pem;
              ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
              ssl_session_timeout 1d;
              ssl_session_cache shared:SSL:50m;
              ssl_stapling on;
              ssl_stapling_verify on;
              add_header Strict-Transport-Security max-age=15768000;
              client_max_body_size 20M;
              client_body_buffer_size 128k;
              default_type application/octet-stream;

              listen 443;
              server_name sub.domain.com;

              root /var/www/html/wiki;

              # For ACME challenge
              location ~ /.well-known {
              allow all;
              }

              location ~ ^/! {
              rewrite ^/!(.*?)/(.*) /$2?$args&animal=$1 last;
              rewrite ^/!(.*)$ /?animal=$1 last;

              }


              location / {
              index doku.php;
              try_files $uri $uri/ @dokuwiki;

              }

              location ~ ^/lib.*.(gif|png|ico|jpg)$ {
              expires 30d;
              }


              location ~ /farm {
              index doku.php;
              autoindex on;
              rewrite ^/farm/?([^/]+)/(.*) /wiki/$2?animal=$1;
              rewrite ^/farm/?([^/]+)$ /wiki/?animal=$1;

              }


              location @dokuwiki {
              rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
              rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
              rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
              rewrite ^/(.*) /doku.php?id=$1&$args last;

              }

              location ~ .php$ {
              include fastcgi_params;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              fastcgi_pass unix:/run/php/php7.0-fpm.sock;
              }

              location ~ /(data|conf|bin|inc)/ {
              deny all;
              }


              }





              share|improve this answer








              New contributor




              Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                0












                0








                0






                You need to understand how DokuWiki handle animals.



                For creating an animal at animal.sub.domain.com,



                You need to define the settings Base Domain for subdomain Animals in farming/configuration as sub.domain.com.



                Next, Add a new animal



                Define the Animal Name / Domain as animal1



                Now, Dokuwiki points the animal1 to animal1.sub.domain.com



                I tested this on a nginx server, it points to the domain correctly.



                Additionally, if you are using SSL, you should redirect your http server to https for security purpose.



                server {
                listen 80;
                server_name sub.domain.com;
                return 301 https://$host$request_uri;
                }


                My sub.domain.com.confnginx settings are below.
                It also includes the location blocks for handling nice url rewrites.



                server {
                listen 80;
                server_name sub.domain.com;
                return 301 https://$host$request_uri;
                autoindex off;
                }

                # For ssl
                server {
                ssl on;
                ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_prefer_server_ciphers on;
                ssl_dhparam /etc/ssl/certs/dhparam.pem;
                ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
                ssl_session_timeout 1d;
                ssl_session_cache shared:SSL:50m;
                ssl_stapling on;
                ssl_stapling_verify on;
                add_header Strict-Transport-Security max-age=15768000;
                client_max_body_size 20M;
                client_body_buffer_size 128k;
                default_type application/octet-stream;

                listen 443;
                server_name sub.domain.com;

                root /var/www/html/wiki;

                # For ACME challenge
                location ~ /.well-known {
                allow all;
                }

                location ~ ^/! {
                rewrite ^/!(.*?)/(.*) /$2?$args&animal=$1 last;
                rewrite ^/!(.*)$ /?animal=$1 last;

                }


                location / {
                index doku.php;
                try_files $uri $uri/ @dokuwiki;

                }

                location ~ ^/lib.*.(gif|png|ico|jpg)$ {
                expires 30d;
                }


                location ~ /farm {
                index doku.php;
                autoindex on;
                rewrite ^/farm/?([^/]+)/(.*) /wiki/$2?animal=$1;
                rewrite ^/farm/?([^/]+)$ /wiki/?animal=$1;

                }


                location @dokuwiki {
                rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
                rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
                rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
                rewrite ^/(.*) /doku.php?id=$1&$args last;

                }

                location ~ .php$ {
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                }

                location ~ /(data|conf|bin|inc)/ {
                deny all;
                }


                }





                share|improve this answer








                New contributor




                Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                You need to understand how DokuWiki handle animals.



                For creating an animal at animal.sub.domain.com,



                You need to define the settings Base Domain for subdomain Animals in farming/configuration as sub.domain.com.



                Next, Add a new animal



                Define the Animal Name / Domain as animal1



                Now, Dokuwiki points the animal1 to animal1.sub.domain.com



                I tested this on a nginx server, it points to the domain correctly.



                Additionally, if you are using SSL, you should redirect your http server to https for security purpose.



                server {
                listen 80;
                server_name sub.domain.com;
                return 301 https://$host$request_uri;
                }


                My sub.domain.com.confnginx settings are below.
                It also includes the location blocks for handling nice url rewrites.



                server {
                listen 80;
                server_name sub.domain.com;
                return 301 https://$host$request_uri;
                autoindex off;
                }

                # For ssl
                server {
                ssl on;
                ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_prefer_server_ciphers on;
                ssl_dhparam /etc/ssl/certs/dhparam.pem;
                ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
                ssl_session_timeout 1d;
                ssl_session_cache shared:SSL:50m;
                ssl_stapling on;
                ssl_stapling_verify on;
                add_header Strict-Transport-Security max-age=15768000;
                client_max_body_size 20M;
                client_body_buffer_size 128k;
                default_type application/octet-stream;

                listen 443;
                server_name sub.domain.com;

                root /var/www/html/wiki;

                # For ACME challenge
                location ~ /.well-known {
                allow all;
                }

                location ~ ^/! {
                rewrite ^/!(.*?)/(.*) /$2?$args&animal=$1 last;
                rewrite ^/!(.*)$ /?animal=$1 last;

                }


                location / {
                index doku.php;
                try_files $uri $uri/ @dokuwiki;

                }

                location ~ ^/lib.*.(gif|png|ico|jpg)$ {
                expires 30d;
                }


                location ~ /farm {
                index doku.php;
                autoindex on;
                rewrite ^/farm/?([^/]+)/(.*) /wiki/$2?animal=$1;
                rewrite ^/farm/?([^/]+)$ /wiki/?animal=$1;

                }


                location @dokuwiki {
                rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
                rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
                rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
                rewrite ^/(.*) /doku.php?id=$1&$args last;

                }

                location ~ .php$ {
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                }

                location ~ /(data|conf|bin|inc)/ {
                deny all;
                }


                }






                share|improve this answer








                New contributor




                Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 2 days ago









                Ranjit SinghRanjit Singh

                11




                11




                New contributor




                Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Ranjit Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388360%2fdokuwiki-farm-on-nginx-using-subdomains%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to make a Squid Proxy server?

                    Is this a new Fibonacci Identity?

                    19世紀