{"id":2836,"date":"2016-02-29T12:41:28","date_gmt":"2016-02-29T17:41:28","guid":{"rendered":"https:\/\/antipaucity.com\/?p=2836"},"modified":"2016-02-29T12:41:28","modified_gmt":"2016-02-29T17:41:28","slug":"putting-owncloud-on-a-subdomain-instead-of-a-subdirectory-on-centos-7","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=2836","title":{"rendered":"putting owncloud 8 on a subdomain instead of a subdirectory on centos 7"},"content":{"rendered":"<p>After moving to a new <a href=\"https:\/\/antipaucity.com\/2016\/02\/24\/its-been-4-5-years\">server<\/a>, I wanted to finally get {{ownCloud}} up and <a href=\"https:\/\/antipaucity.com\/2015\/04\/30\/owncloud-vs-pydio-diy-cloud-storage\">running<\/a> (over <a href=\"https:\/\/antipaucity.com\/2016\/02\/26\/automated-lets-encrypt-ssl-certificate-renewal-on-centos-7\">SSL<\/a>, of course) on it.<\/p>\n<p>And I like subdomains for different services, so I wanted to put it at sub.domain.tld. This turns out to be not as straight-forward as one might otherwise hope, sadly &#8211; ownCloud expects to be installed to domain.tld\/owncloud (and plops itself into <code>\/var\/www\/owncloud<\/code> by default (or sometimes <code>\/var\/www\/html\/owncloud<\/code>).<\/p>\n<p>My <a href=\"https:\/\/www.hetzner.de\/en\/hosting\/produktmatrix\/rootserver\">server<\/a> is running {{CentOS}} 7, {{Apache}} 2.4, and {{MariaDB}} (a drop-in replacement for {{MySQL}}). This overview is going to presume you&#8217;re running the same configuration &#8211; feel free to spin one up quickly at <a href=\"https:\/\/www.digitalocean.com\/?refcode=d197a961987a\">Digital Ocean<\/a> to try this yourself.<\/p>\n<p>Start with the <a href=\"http:\/\/owncloud.org\">ownCloud<\/a> <a href=\"https:\/\/doc.owncloud.org\/server\/8.2\/admin_manual\/installation\/linux_installation.html\">installation<\/a> instructions, which will point you to the {{openSUSE}}\u00a0<a href=\"http:\/\/software.opensuse.org\/download.html?project=isv:ownCloud:community&amp;package=owncloud\">build service page<\/a>, where you&#8217;ll follow the steps to add the ownCloud community repo to your yum repo list, and install ownCloud. (In my last how-to, 8.0 was current &#8211; 8.2 rolled-out since I installed 8.1 a couple days ago.)<\/p>\n<p>Here is where you need to go &#8220;off the reservation&#8221; to get it ready to actually install.<\/p>\n<p>Add a VirtualHost directive to redirect http:\/\/sub.domain.tld to https:\/\/sub.domain.tld (cipher suite list compiled <a href=\"https:\/\/mozilla.github.io\/server-side-tls\/ssl-config-generator\">thusly<\/a>):<\/p>\n<p><code><br \/>\n&lt;VirtualHost *:80&gt;<br \/>\nServerName sub.domain.tld<br \/>\nRedirect permanent \/ https:\/\/sub.domain.tld\/<br \/>\n&lt;\/VirtualHost&gt;<br \/>\n<\/code><\/p>\n<p>Configure an SSL VirtualHost directive to listen for sub.domain.tld:<\/p>\n<p><code><br \/>\n&lt;VirtualHost *:443&gt;<br \/>\nSSLCertificateFile \/etc\/letsencrypt\/live\/sub.domain.tld\/cert.pem<br \/>\nSSLCertificateKeyFile \/etc\/letsencrypt\/live\/sub.domain.tld\/privkey.pem<br \/>\nSSLCertificateChainFile \/etc\/letsencrypt\/live\/sub.domain.tld\/fullchain.pem<br \/>\nDocumentRoot \/var\/www\/subdomain<br \/>\nServerName sub.domain.tld<br \/>\nErrorLog logs\/subdomain-error_log<br \/>\nCustomLog logs\/subdomain-access_log \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \\\"%r\\\" %b\"<br \/>\nServerAdmin user@domain.tld<br \/>\nSSLEngine on<br \/>\nSSLProtocol all -SSLv2 -SSLv3<br \/>\nSSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256<br \/>\nSSLHonorCipherOrder     on<br \/>\nSSLOptions +StdEnvVars<br \/>\n&lt;Directory \"\/var\/www\/cgi-bin\"&gt;<br \/>\nSSLOptions +StdEnvVars<br \/>\nSetEnvIf User-Agent \".*MSIE.*\"\u00a0nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0<br \/>\n# allow .htaccess to change things<br \/>\n&lt;Directory \"\/var\/www\/subdomain\"&gt;<br \/>\nOptions All +Indexes +FollowSymLinks<br \/>\nAllowOverride All<br \/>\nOrder allow,deny<br \/>\nAllow from all<br \/>\n&lt;\/Directory&gt;<br \/>\n&lt;\/VirtualHost&gt;<\/code><\/p>\n<p>Comment-out every line in (or remove) <code>\/etc\/httpd\/conf.d\/owncloud.conf<\/code>.<\/p>\n<p>Move <code>\/var\/www\/html\/owncloud\/*<\/code> to <code>\/var\/www\/subdomain<\/code>.<\/p>\n<p>Make sure permissions are correct on <code>\/var\/www\/subdomain<\/code>:<\/p>\n<ul>\n<li><code>chown -R :apache \/var\/www\/subdomain<\/code><\/li>\n<\/ul>\n<p>Run the command-line installer: <code>\/var\/www\/subdomain\/occ maintenance:install<\/code><\/p>\n<p>Fix ownership of the config file, <code>\/var\/www\/subdomain\/config\/config.php<\/code> to <code>root:apache<\/code>.<\/p>\n<p>In config.php,<\/p>\n<ul>\n<li>change trusted domains from &#8216;<code>localhost<\/code>&#8216; to &#8216;<code>sub.domain.tld<\/code>&#8216;<\/li>\n<li>make sure &#8216;<code>datadirectory<\/code>&#8216; is equal to <code>\/var\/www\/subdomain\/data<\/code><\/li>\n<li>change &#8216;<code>overwrite.cli.url<\/code>&#8216; from &#8216;<code>localhost<\/code>&#8216; to &#8216;<code>https:\/\/sub.domain.tld<\/code>&#8216;<\/li>\n<\/ul>\n<p>Navigate to http:\/\/sub.domain.tld, and follow the prompts &#8211; and you\u00a0<em>should<\/em> be a happy camper.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After moving to a new server, I wanted to finally get {{ownCloud}} up and running (over SSL, of course) on it. And I like subdomains for different services, so I wanted to put it at sub.domain.tld. This turns out to be not as straight-forward as one might otherwise hope, sadly &#8211; ownCloud expects to be &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=2836\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">putting owncloud 8 on a subdomain instead of a subdirectory on centos 7<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[41,45],"tags":[97,166,178,390,540,713,725],"keyring_services":[],"class_list":["post-2836","post","type-post","status-publish","format-standard","hentry","category-technical","category-tutorial","tag-apache","tag-centos","tag-cloud","tag-how-to","tag-owncloud","tag-ssl","tag-storage"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2836"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2836\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2836"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=2836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}