Hi, I tried to install OwnCloud on Windows Server 2008 R2 and Windows 7 the last days. Doing this, I ran into much trouble and it was a little afford to get it working. But now, after the 5th installation, I think, I've got a way, how it is working quite fine and I want to share it with you. Please keep in mind, that there is a lot of security tuning to do with IIS before going online (use SSL, deactivate week ciphers, change application pool, ...). But here just a quick and dirty way to get OwnCloud up and running. I used following prerequisites while writing this:
fresh installation of Windows Server 2008 R2 Standard on a virtual machine (IIS 7.5)
OwnCloud 3.0.2 (but same procedure for 3.0.3, 4.0, 4.0.1, 4.0.2)
PHP 5.4.1+ (VC9 x86 Non Thread Safe (2012-Apr-25 23:01:06)) - http://windows.php.net/download/
MySQL Community Server 5.5.23+ (Windows (x86, 64-bit), MSI Installer)- https://www.mysql.com/downloads/mysql/
7-Zip - http://www.7-zip.org/
Notepad++ - http://notepad-plus-plus.org/
I assume the following:
You have root access to your webserver
You know how to use a command line (but I'll try to keep everything as simple as possible)
You start the command line with administrative privileges
Please click on any image to get a larger version.
Part 1 - Installation of IIS 7.5 Enable the Windows Server Role Web Server (IIS) by using the Server Manager (Add Roles).
Choose Web Server (IIS)
Install the following features: Common HTTP Features
Static Content
Default Document
Directory Browsing
HTTP Errors
Health and Diagnostics
HTTP Logging
Request Monitor
Security
Request Filtering
Performance
Static Content Compression
Management Tools
IIS Management Console
Part 2 - Installation of PHP on Windows Server 2008 R2
Get the binaries from http://windows.php.net/download/ and unzip it to C:\php Copy C:\php\php.ini-development to C:\php\php.ini Open C:\php\php.ini in an editor and change or uncomment the following settings (asuming that you want to let users upload files up to 1GB size):
max_execution_time = 300
memory_limit = 1G
display_errors = On (if everything is working fine after installation, you MUST change this back to Off)
post_max_size = 1G
extension_dir = "ext"
cgi.force_redirect = 0
fastcgi.impersonate = 1
upload_max_filesize = 1G
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_openssl.dll (since 4.5.1)
extension=php_pdo_mysql.dll (since v4.0)
date.timezone = "Europe/Vienna" (according to the timezone you're in)
(remember to restart IIS after making changes to php.ini using command-line command iisreset)
Part 3 - Installation of MySQL Community Server Download the MSI Installer und do a Typical-Installation. Afterwards start the Instance Configuration Wizard.
Choose Standard Configuration to make things easier.
Install MySQL as a Windows Service, choose the service name and make it launch automatically
After that enter a password for the root account. Please use a secure one and write it down somewhere.
Finish the installation
Part 4 - Configure IIS There are some things to do with IIS before we can use it with PHP and OwnCloud Activate PHP and FastCGI Please follow the steps on this blog post by Phil on MSDN Blogs: https://blogs.msdn.com/b/philpenn/archive/2009/07/19/deploying-iis-7-5fastcgi-php-on-server-core.aspx. appcmd.exe can be found under C:\Windows\System32\inetsrv
Add a MIME Type for SVG I realized on some web servers, that there is no MIME Type for SVG files defined. Thus no OwnCloud Icons are shown on the web site. You can add a MIME Type (File name extension: .svg; MIME Type: image/svg+xml) by firing up a command line and using: Code: Select all
appcmd set config /section:staticContent / +"[fileExtension='.svg',mimeType='image/svg+xml']"
You get an error message, if the MIME Type is already existing. Otherwise it's been added now
.
Add new Default Document Because PHP applications are mostly using index.php as default document, you have to add this to your IIS Default Documents. Do this by typing the following in to a command line: Code: Select all
appcmd set config /section:defaultDocument /+files. [value='index.php']
If you like, you can delete all other existing entries (you will not need it) using these commands: Code: Select all
appcmd set config /section:defaultDocument [value='default.htm'] appcmd set config /section:defaultDocument [value='default.asp'] appcmd set config /section:defaultDocument [value='index.htm'] appcmd set config /section:defaultDocument [value='index.html'] appcmd set config /section:defaultDocument [value='iisstart.htm']
/-files. /-files. /-files. /-files. /-files.
(Have a look at http://technet.microsoft.com/en-us/library/cc771439%28v=ws.10%29.aspx if you want to know more) Change maximum allowed content length To make IIS accept large file uploads, you have to change the maximum allowed content length. Do this by using the IIS Management Console. On server level choose the icon Request Filtering from the middle pane. Then click on Edit Feature Settings on the right pane. Enter a value of your choice. To upload files up to 1GB, you have to enter at least 1.000.000.000. Please refer to https://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits for more information.
Part 5 - Installation of OwnCloud
Download the latest stable release of OwnCloud here: http://owncloud.org/install/
Unpack the contents of the file to C:\inetpub\wwwroot
Only need in versions before 4.0.2: Open the file C:\inetpub\wwwroot\lib\base.php in an editor and search for "Redirect to installer if not installed". There is a bug in version 3 and 4 which is leading to endless redirects as long as OwnCloud is not configured because of the slash before index.php (Windows uses backslashes). In this line, change the first occurance of '/index.php' to DIRECTORY_SEPARATOR.'index.php'. It has to look like this: Code: Select all
// Redirect to installer if not installed if (!OC_Config::getValue('installed', false) && OC::$SUBURI != DIRECTORY_SEPARATOR.'index.php') { $url = 'http://'.$_SERVER['SERVER_NAME'].OC:: $WEBROOT.'/index.php'; header("Location: $url"); exit(); }
Allow user IUSR Read-/Write access to directory C:\inetpub\wwwroot\config
Since version 4.0.1: Allow user IURS Read-/Write access to directory C:\inetpub\wwwroot\apps
(Create folder C:\inetpub\wwwroot\data -> only before v4.0.1, add the user IUSR to NTFS directory security and grant him Read-/Write access.) Outdated since 4.0.1
If you want to store uploaded user content somewhere else than in C:\inetpub\wwwroot\data (which i warmly recommend you to do!), than create this directory (let's say D:\OwnCloud\data) and grant Read-/Write access to user IUSR
Fire up your browser, point it to http://localhost and finish the installation
Part 6 - Closing work If everything is working well, you're ready for the last steps
User IUSR doesn't need access to C:\inetpub\wwwroot\config anymore, you can remove it from directory security
If you store uploaded user content somewhere else than in C:\inetpub\wwwroot\data you can remove the user IUSR from there as well
If you created it, delete info.php from C:\inetpub\wwwroot
That's it for now. This is the way it is working for me. Feel free to comment this entry. Bye, Stefan (P.S.: Just realized, that version 3.0.3 has been released while writing this guide. I don't know, what they've changed and this guide is still ok. But I'll check tomorrow). Update - 2012-05-04 Checked the differences between 3.0.2 and 3.0.3. It seems, that 3.0.3 is redirecting to HTTPS after logging in. This is a good idea, but isn't working until you create a HTTPS binding for your website. And - of course - a SSL certificate. Or you have a look at http://forum.owncloud.org/viewtopic.php?f=3&t=2420
Update - 2012-05-22 - Version 4.0 If you get an error 500 or PHP-Error (Undefined class constant 'MYSQL_ATTR_INIT_COMMAND') you have to enable extension php_pdo_mysql.dll in php.ini. Update - 2012-06-05 - Version 4.0.1 Unbelievable, but sadly true: The "endless-redirect-bug" is still there. I've posted it in the forums, I've created an issue, I've postet in the mailing lists. It seems, it's not possible, to change one line in the code. Good news: You don't need a HTTPS binding anymore and there's no need to create the "data" directory in C:\inetpub\wwwroot before setup. Update - 2012-06-08 HowTo works on Windows Server 2012 (IIS 8) RC too Update - 2012-06-11 - Version 4.0.2 Endless redirect bug finally fixed in v.4.0.2! Thx a lot for that!