我是一个 opensuse 的使用者,不是技术人员,使用 linux 只是想提高安全性。
最近需要使用局域网网盘,搭建了一个 owncloud,使用的是官方的源。
download.owncloud.org/download/repositories/stable/openSUSE_Leap_42.2/
但是我常使用的 firefox 提醒的对,应该使用 SSL。但是在局域网使用,没有必要买证书,所以就选择了 openssl 。
所以啊,在 baidu 和 google 中查找了一番,果断实验,但是没有一个成功的。
比如这个: zhidao.baidu.com/question/1833659810710006300.html 按照这个写法,连 apache2 都不能启动。
unixman 里面有一个外国人写的,按照他的文章操作,apache2 能启动,但是依然不是 https。
几乎所有的帖子都是同样的思路和代码。不知道是我操作不对还是 opensuse 的特殊性,前后一共操作了好多天,都没有一次成功。
论坛里面有朋友安装了 owncloud+lamp 的,麻烦给帮个忙。感谢
为了演示使用如下的地址:http://www.cnblogs.com/findumars/p/4862162.html
操作如下:
编辑 /etc/apache2/conf.d/owncloud.conf 启用 HTTPS。对于重写规则中的 NC、R 和 L 的意义,你可以参考 Apache 文档:
Alias /owncloud /var/www/owncloud ==== 这里我将地址修改为 owncloud 命令的目录 /usr/bin/owncloud
<VirtualHost 192.168.0.15:80> ===== 这里我将 ip 修改为自己的 192.168.86.100:80
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
<VirtualHost 192.168.0.15:443> ===== 这里我将 ip 修改为自己的 192.168.86.100:443
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
DocumentRoot /var/www/owncloud/
<Directory /var/www/owncloud> ===== 这里我将地址修改为 /srv/www/htdocs/owncloud
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
启用重写模块并重启 Apache:
# a2enmod rewrite
# systemctl restart apache2
重启 apache2 出现: Job for apache2.service failed the control process exited with error code. See “systemctl status apache2.service” and " journalctl -xe " for details.
cnblogs.com/findumars/p/4862162.html
错误详细情况如下:
● apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2017-10-05 22:19:33 CST; 2min 49s ago
Process: 4583 ExecStop=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful-stop (code=exited, status=1/FAILURE)
Process: 4574 ExecStart=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k start (code=exited, status=1/FAILURE)
Main PID: 4574 (code=exited, status=1/FAILURE)
10 月 05 22:19:33 linux-mf16.suse systemd[1]: Starting The Apache Webserver...
10 月 05 22:19:33 linux-mf16.suse start_apache2[4574]: AH00526: Syntax error on line 17 of /etc/apache2/conf.d/owncloud.conf:
10 月 05 22:19:33 linux-mf16.suse start_apache2[4574]: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
10 月 05 22:19:33 linux-mf16.suse systemd[1]: apache2.service: Main process exited, code=exited, status=1/FAILURE
10 月 05 22:19:33 linux-mf16.suse start_apache2[4583]: AH00526: Syntax error on line 17 of /etc/apache2/conf.d/owncloud.conf:
10 月 05 22:19:33 linux-mf16.suse start_apache2[4583]: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
10 月 05 22:19:33 linux-mf16.suse systemd[1]: apache2.service: Control process exited, code=exited status=1
10 月 05 22:19:33 linux-mf16.suse systemd[1]: Failed to start The Apache Webserver.
10 月 05 22:19:33 linux-mf16.suse systemd[1]: apache2.service: Unit entered failed state.
10 月 05 22:19:33 linux-mf16.suse systemd[1]: apache2.service: Failed with result 'exit-code'.
============== 经过查看,错误出现在 17,18 行
日志文件记录的错误:
-- Subject: apache2.service 单元已开始停止操作
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- apache2.service 单元已开始停止操作。
10 月 05 22:16:00 linux-mf16.suse start_apache2[4493]: AH00526: Syntax error on line 17 of /etc/apache2/conf.d/owncloud.conf:
10 月 05 22:16:00 linux-mf16.suse start_apache2[4493]: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
10 月 05 22:16:00 linux-mf16.suse systemd[1]: apache2.service: Control process exited, code=exited status=1
10 月 05 22:16:00 linux-mf16.suse systemd[1]: Stopped The Apache Webserver.
-- Subject: apache2.service 单元已结束停止操作
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- apache2.service 单元已结束停止操作。
10 月 05 22:16:00 linux-mf16.suse systemd[1]: apache2.service: Unit entered failed state.
10 月 05 22:16:00 linux-mf16.suse systemd[1]: apache2.service: Failed with result 'exit-code'.
10 月 05 22:16:00 linux-mf16.suse systemd[1]: Starting The Apache Webserver...
-- Subject: apache2.service 单元已开始启动
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- apache2.service 单元已开始启动。
10 月 05 22:16:00 linux-mf16.suse start_apache2[4505]: AH00526: Syntax error on line 17 of /etc/apache2/conf.d/owncloud.conf:
10 月 05 22:16:00 linux-mf16.suse start_apache2[4505]: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
10 月 05 22:16:00 linux-mf16.suse systemd[1]: apache2.service: Main process exited, code=exited, status=1/FAILURE
10 月 05 22:16:00 linux-mf16.suse start_apache2[4514]: AH00526: Syntax error on line 17 of /etc/apache2/conf.d/owncloud.conf:
10 月 05 22:16:00 linux-mf16.suse start_apache2[4514]: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
10 月 05 22:16:00 linux-mf16.suse systemd[1]: apache2.service: Control process exited, code=exited status=1
10 月 05 22:16:00 linux-mf16.suse systemd[1]: Failed to start The Apache Webserver.
-- Subject: apache2.service 单元已失败
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- apache2.service 单元已失败。