您尚未登录。

#1 2015-03-15 19:33:59

roadgo
会员
注册时间: 2012-04-07
帖子: 380

安装owncloud(我的云盘之路一)

一、安装php
pacman -S  php php-gd php-intel php-mcrypt php-fpm  php-pgsql
leafpad  /etc/php/php.ini
找到类似这样的
;extension=bcmath.so
;extension=bz2.so
;extension=calendar.so
extension=curl.so
;extension=dba.so
;extension=enchant.so
;extension=exif.so
;extension=ftp.so
去掉
gd.so
iconv.so
xmlrpc.so
zip.so
bz2.so
curl.so
intl.so
mcrypt.so
openssl.so
pdo_pgsql.so
pgsql.so
前面的;号

;date.timezone =    改成 date.timezone = Asia/Shanghai

二、安装nginx web服务器
# pacman -S nginx
启动服务
要启动Nginx服务,运行以下命令:
# systemctl enable nginx
要Nginx服务开机时启动,运行以下命令:
# systemctl start nginx
在浏览器中输入http://127.0.0.1 出现的默认页面是:
Welcome to nginx!
启动php-fpm
# systemctl enable php-fpm
# systemctl start php-fpm
初次测试
在当前用户目录下建一个new文件目录
内建一个index.html
内容为

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
</body>
</html>

#chown -R http:http /home/当前目录/new
#vi /etc/nginx/nginx.conf
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
#将下面这一行改成root /home/当前目录/new;
            root   /usr/share/nginx/html;
            index  index.html index.htm index.php;
        }
如果出现Welcome to nginx!
成功了。
再内建一个index.php
内容为
<?php
  phpinfo();
?>
#chown -R http:http /home/当前目录/new
#vi /etc/nginx/nginx.conf
将这段

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;

        }
改成

      server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root   /home/qwer/new;

        location / {
            
            index  index.php;
        }

       location ~ \.php$ {
          #fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
          fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
          fastcgi_index index.php;
          include fastcgi.conf;
       }
       location = /favicon.ico {
          log_not_found off;
       }

       
改过后要
systemctl restart nginx       
systemctl restart php-fpm       
在浏览器中输入http://127.0.0.1 出现的默认页面是: php的调试页
说明你成功了       

三、安装owncloud
https://owncloud.org/install/#instructions-server
下载owncloud包
% tar xvjf owncloud-8.0.0.tar.bz2
在自己的用户目录下就有了一个owncloud文件夹
#chown -R http:http /home/当前目录/new
当出现owncloud的页面就成功了。( No database drivers (sqlite, mysql, or postgresql) installed.)
四、postgresql
pacman -S postgresql
新建一个放数据库的文件夹
mkdir mydata
将mydata的所有权改成postgres用户
sudo chown -c -R postgres:postgres mydata
sudo -i -u postgres
initdb --locale en_US.UTF-8 -E UTF8 -D '/home/当前目录/mydata'
# systemctl enable postgresql
# systemctl start postgresql
创建一个超级用户
createuser -s -U postgres --interactive
输入要增加的用户名: 最好与我登录Arch的用户名同名
创建一个数据库
createdb myDatabaseName

出现错误  Your data directory and files are probably accessible from the internet because the .htaccess file does not work. For information how to properly configure
#vi /etc/nginx/nginx.conf
加入
  location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
    deny all;
    }
出现错误
http://127.0.0.1/index.php/apps/files/
404 Not Found
这个问题是最烦人,找了很多网站,没找到,花了三四个晚上,太痛苦了。
下面是我的/etc/nginx/nginx.conf
大家自己研究吧。

#user html;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root   /home/qwer/owncloud;

        location / {
            
            index  index.php;
            rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
            rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
        }

       location ~ \.php(?:$|/)   {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          #fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
          fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
          fastcgi_index index.php;
          include fastcgi.conf;
       }

       location = /favicon.ico {
          log_not_found off;
       }

  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;
    }



        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   [url]http://127.0.0.1[/url];
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #   fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

最后郑重声明:本人不岐视女性,特别是爱帮助人的女性。

最近编辑记录 roadgo (2015-03-20 17:19:28)

离线

#2 2015-03-15 20:53:52

phoenixlzx
晩ご飯だよー
注册时间: 2011-08-19
帖子: 1,789
个人网站

Re: 安装owncloud(我的云盘之路一)

..... 代码部分用 BBCode 包起来呀

离线

#3 2015-03-23 19:35:45

smallville
会员
注册时间: 2013-12-23
帖子: 29

Re: 安装owncloud(我的云盘之路一)

Your data directory and files are probably accessible from the internet because the .htaccess file does not work. For information how to properly configure
这个错误下面的代码不起作用啊.楼主是怎么处理的?

location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
    deny all;
    }

离线

#4 2015-03-24 16:57:48

roadgo
会员
注册时间: 2012-04-07
帖子: 380

Re: 安装owncloud(我的云盘之路一)

我的跟你的一样啊,正常啊
用我的配置文件,你再试试。

最近编辑记录 roadgo (2015-03-24 16:59:23)

离线

#5 2015-03-25 10:41:54

smallville
会员
注册时间: 2013-12-23
帖子: 29

Re: 安装owncloud(我的云盘之路一)

修改你的配置用也不行,已放弃,谢谢.

离线

页脚