owncloud无法启动

xuanjunxuan 发布于 2017/05/27 18:48
阅读 663
收藏 0

本人菜鸟,想在个人电脑上利用owncloud搭建私人去。

搭建过程参考这个链接:http://gabrielbeaver.me/2015/07/owncloud-series-getting-started/

一、环境。

两台电脑,一台装Linux mint 18,一台装win7。通过交换机连接。

二、搭建过程。

1、安装opensll

    # sudo apt-get install openssh-server

2、安装apache2

    # sudo apt-get install apache2

3、安装PHP

    # sudo apt-get install php7.0 php7.0-mysql && sudo apt-get install php7.0-curl php7.0-gd imagick php7.0-intl php7.0-json php7.0-mcrypt

在这里安装php7.0-imagick的时候出现错误,没找到,最后去掉php7.0才能安装。

4、设置服务器名并激活它

    # sudo nano /etc/apache2/conf-available/servername.conf

    # sudo a2enconf servername

5、激活ssl和rewrite模块并重启apache2

    # sudo a2enmod ssl && sudo a2enmod rewrite && sudo service apache2 restart

6、这时尝试在浏览器输入localhost,显示成功

Apache2 Ubuntu Default Page

It works!

7、配置php

    # sudo mkdir /etc/php/7.0/apache2

    # sudo nano /etc/php/7.0/apache2/php.ini

在php.ini里面添加,设置最大上传文件为2G

    post_max_size = 2G

    upload_max_filesize = 2G

8、安装mysql

    # sudo apt-get install mysql-server

9、配置mysql,将测试用户,测试数据库、远程访问等删除

    # sudo mysql_secure_installation

10、创建owncloud数据库

    # sudo mysql -u root -p

 mysql> CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'CREATE_PASSWORD';

    mysql> CREATE DATABASE owncloud;

    mysql> GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost';

    mysql> FLUSH PRIVILEGES;

    mysql> exit

此处有疑问,不知道这个数据库的作用是什么。

11、创建owncloud数据文件夹

    # sudo mkdir /owncloud && sudo mkdir /owncloud/data

    # sudo chown -R www-data:www-data /owncloud/data

12、下载并安装owncloud,我下载的是10.0.1版本。解压到/var/www/

    # sudo tar -xvf owncloud-10.0.1.tar.bz2 -C /var/www/

    # sudo chown www-data:www-data -R /var/www/owncloud/

13、设置owncloud配置文件

    # sudo nano /etc/apache2/sites-available/owncloud.conf

输入:

    <VirtualHost *:80>
     ServerAdmin X@localhost
     ServerName cloud.X.com
      
     Redirect permanent / https://cloud.X.com/
     DocumentRoot /var/www/owncloud
 
     <Directory />
                Options FollowSymLinks
                AllowOverride All
    </Directory>
 
     ErrorLog ${APACHE_LOG_DIR}/owncloud-HTTP-error.log
     CustomLog ${APACHE_LOG_DIR}/owncloud-HTTP-access.log combined
</VirtualHost>

14、在ssl里创建文件夹,用于身份认证

    # sudo mkdir /etc/apache2/ssl && sudo mkdir /etc/apache2/ssl/owncloud

    # sudo openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout /etc/apache2/ssl/owncloud/server.key -out /etc/apache2/ssl/owncloud/server.crt

15、配置owncloud安装访问

    # sudo nano /etc/apache2/sites-available/owncloud-ssl.conf

输入

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost
                ServerName cloud.X.com

                #上面这两行不理解,原文是ServerAdmin webmaster@localhost和ServerName cloud.gabrielbeaver.me,不知道与owncloud.conf有什么影响
               
                Header always add Strict-Transport-Security "max-age=15768000; preload"
                DocumentRoot /var/www/owncloud
                <Directory />
                        Options FollowSymLinks
                        AllowOverride All
                </Directory>
 
                <Directory /var/www/owncloud>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                </Directory>
 
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
 
                SSLEngine on
                SSLCertificateFile /etc/apache2/ssl/server.crt
                SSLCertificateKeyFile /etc/apache2/ssl/server.key

                #上面这两行有问题,原文件是在/etc/apache2/ssl/owncloud/下面
 
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
 
                BrowserMatch "MSIE [2-6]" \
                                nokeepalive ssl-unclean-shutdown \
                                downgrade-1.0 force-response-1.0
                # MSIE 7 and newer should be able to use keepalive
                BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
 
        </VirtualHost>
</IfModule>

16、启用相关配置和模块,并重新加载apache2

    # sudo a2ensite owncloud.conf && sudo service apache2 reload

    # sudo a2enmod headers

    # sudo a2ensite owncloud-ssl.conf && sudo service apache2 reload

17、在浏览器输入 cloud.X.com,成功出现 “Welcome to nginx!”,但却一直没有出现与owncloud相关的页面。根据上面链接的说明,此时应该会出现owncloud的配置页面。无论怎么修改ServerName,重新a2ensite和a2enmod都一样。

18、到底是PHP没安装成功?还是owncloud没安装好?还是哪里配置出错?

 

加载中
返回顶部
顶部