Centos7.1 1053最小化安裝lnmp通過yum安裝,由於Centos7沒有mysql的yum源,所以要自己安裝mysql的yum源,但是安裝上了,在我這yum安裝只有幾十K的速度,所以乾脆去yum源裏下載了mysql-server的rpm包,然後通過yum安裝的rpm包,省了不少時間,lnmp的搭建這裏就不再多說了,記着關閉selinux不然會提示File not found。
一、下載owncloud並解壓的網站目錄
[root@node3 ~]# axel https://download.owncloud.org/community/owncloud-8.0.3.tar.bz2
二、添加nginx虛擬主機
這個配置文件用百度找了半天都不行,最後用谷歌一下就找到了……之前去官網的文檔裏沒找到,谷歌搜出來的……官網有兩種配置一種開啓ssl的,還有如何修改爲沒有ssl的,這裏我貼出我自己使用的沒有使用ssl的配置文件。
upstream php-handler { server 127.0.0.1:9000; #server unix:/var/run/php5-fpm.sock; } server { listen 8080; server_name cloud.example.com; # Path to the root of your installation root /usr/share/nginx/html/owncloud/; # set max upload size client_max_body_size 10G; fastcgi_buffers 64 4K; # Disable gzip to avoid the removal of the ETag header gzip off; # Uncomment if your server is build with the ngx_pagespeed module # This module is currently not supported. #pagespeed off; rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect; rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect; rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect; index index.php; error_page 403 /core/templates/403.php; error_page 404 /core/templates/404.php; location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){ deny all; } location / { # The following 2 rules are only needed with webfinger rewrite ^/.well-known/host-meta /public.php?service=host-meta last; rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; rewrite ^/.well-known/carddav /remote.php/carddav/ redirect; rewrite ^/.well-known/caldav /remote.php/caldav/ redirect; rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; try_files $uri $uri/ /index.php; } location ~ \.php(?:$|/) { fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass php-handler; } # Optional: set long EXPIRES header on static assets location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires 30d; # Optional: Don't log access to assets access_log off; } }
三,重啓nginx並訪問
訪問會出錯,提示缺少必須的php模塊,執行如下命令即可,記得重啓php-fpm。
[root@localhost ~]# yum install -y php-dom php-xmlwriter php-gd
再次刷新就可以了
四、配置數據庫
mysql> grant all on *.* to 'everyoo'@'%' identified by 'everyoo'; Query OK, 0 rows affected (0.03 sec) mysql> flush privileges; Query OK, 0 rows affected (0.02 sec)
再次提示錯誤,權限問題,缺少data目錄
[root@localhost owncloud]# mkdir data [root@localhost owncloud]# chown -R apache.apache .
再次訪問,不知道爲什麼我用localhost和127.0.0.1總是不行。
只好用了本機的ip地址,但是還是會報錯,出現了一個加了前綴的數據庫用戶,並不是我填寫的那個。
只要去修改配置文件爲創建的那個就可以了。
[root@localhost owncloud]# vim config/config.php
再次配置就可以了。