Install Apache web server.

Then install MySQL server.

# pkg install mysql56-server # echo 'mysql_enable="YES"' >> /etc/rc.conf # service mysql-server start

Create database owncloud.

# mysql -u root mysql> create database owncloud character set utf8;

Grant permissions to user ownuser.

mysql> grant all on owncloud.* to ownuser@localhost identified by 'Password'; mysql> exit;

Install ownlcloud.

After install go to directory /usr/local/etc/apache24 and create directory ssl.

# cd /usr/local/etc/apache24 # mkdir ssl # cd ssl

Generate key.

# openssl genrsa -des3 -out simple.key 2048

Generate certificate.

# openssl req -new -key simple.key -out simple.csr # openssl x509 -req -days 365 -in simple.csr -signkey simple.key -out simple.crt # chmod 600 simple.*

Open Apache config.

# vi /usr/local/etc/apache24/httpd.conf

Uncomment this parameters.

LoadModule ssl_module libexec/apache24/mod_ssl.so LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so Include etc/apache24/extra/httpd-ssl.conf


Open ssl config.

# vi /usr/local/etc/apache24/extra/httpd-ssl.conf

And add virtualhost.

<VirtualHost *:80> ServerName 127.0.0.1 Redirect permanent / https://192.168.1.179 </VirtualHost>

Change parameters in VirtualHost _default_:443.

DocumentRoot "/usr/local/www/owncloud" ServerName 127.0.0.1:443

Specify path of key and certificate.

SSLCertificateFile "/usr/local/etc/apache24/ssl/simple.crt" SSLCertificateKeyFile "/usr/local/etc/apache24/ssl/simple.key"

Restart Apache server.

# service apache24 restart