개인소장용 글입니다.


os: archlinux


nginx + php-fpm + mysql + owncloud


패키지설치

pacman -S mysql nginx php-fpm php-apcu php-gd php-intl ttf-baekmuk (한글폰트)


[nginx.conf]


#user html;

worker_processes  1;


error_log  /var/log/nginx/error.log;

#error_log  /var/log/nginx/error.log  notice;

#error_log  /var/log/nginx/error.log  info;


#pid        logs/nginx.pid;


events {

    worker_connections  128;

}


http {

    charset utf-8;

    include       mime.types;

    default_type  application/octet-stream;

    sendfile        on;

    #tcp_nopush     on;


    #keepalive_timeout  0;

    keepalive_timeout  65;


    #gzip  on;


server {

        listen       80;

        server_name  192.168.25.7;

       

location / {

            root   /usr/share/nginx/html;

            index  index.html index.htm;

             }


        }#80 exit


 server {


        listen 443 ssl;

        server_name 192.168.25.7;


        ssl_certificate /etc/nginx/server.crt;

        ssl_certificate_key /etc/nginx/server.key;


        location / {

           }

        # Path to the root of your installation

        root /srv/http/;


        client_max_body_size 1000M;

        fastcgi_buffers 64 4K;

        location = / {

            error_page 404 /owncloud/core/templates/404.php;

            }


        rewrite ^/owncloud/caldav(.*)$ /owncloud/remote.php/caldav$1 redirect;

        rewrite ^/owncloud/carddav(.*)$ /owncloud/remote.php/carddav$1 redirect;

        rewrite ^/owncloud/webdav(.*)$ /owncloud/remote.php/webdav$1 redirect;

        rewrite ^/core/(.*)$ /owncloud/core/$1 redirect;


        index index.php;

        error_page 403 = /owncloud/core/templates/403.php;

        error_page 404 = /owncloud/core/templates/404.php;


        location = /robots.txt {

            allow all;

            log_not_found off;

            access_log off;

            }


         location ~ ^(.+?\.php)(/.*)?$ {

                try_files $1 = 404;

                include fastcgi_params;

                fastcgi_param SCRIPT_FILENAME $document_root$1;

                fastcgi_param PATH_INFO $2;

                fastcgi_param HTTPS on;

                fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;

                }

        #owncloud disable access to crucial folders

        location ~ ^/(data|config|\.ht|db_structure\.xml|README) {

                deny all;

        }


         location = /favicon.ico {

            return 204;

            access_log     off;

            log_not_found  off;

        }


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

        }



   } #443 exit


 } #http exit


[php-fpm.conf]

listen = /run/php-fpm/php-fpm.sock  주석제거
pm = dynamic

pm.max_children = 10  
pm.start_servers = 2  
pm.min_spare_servers = 1 
pm.max_spare_servers = 3  


[php.ini] 

open_basedir = /srv/http/:/srv/http/owncloud/ 주석제거 및 추가

upload_tmp_dir = /srv/http/owncloud/data

disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open, set_ini  

memory_limit = 1024M  

post_max_size = 1024M  

upload_max_filesize = 1024M  

주석(;)제거

extension=gd.so  

extension=iconv.so  

extension=intl.so  

extension=mysqli.so  

extension=mysql.so  

extension=openssl.so  

extension=pdo_mysql.so  

extension=xmlrpc.so  

extension=zip.so  


[apcu.ini] 위치: /etc/php/conf.d/apcu.ini 

캐시관리 

extension=apcu.so  

; enable APC  

apc.enabled=1  

; The number of shared memory segments  

apc.shm_segments=1  

; The size of each shared memory segment  

apc.shm_size=16M  

; The number of seconds a cache entry is allowed to idle in a slot in case this  

; cache entry slot is needed by another entry.  

apc.ttl=259200  


[mysql] *아치리눅스는 mysql이 mariadb

mysql -u root -p

데이터베이스 생성 및 권한부여

mysql> CREATE DATABASE owncloud;
mysql> GRANT ALL PRIVILEGES ON owncloud.* TO root;

mysql> FLUSH PRIVILEGES;


[owncloud]

cd /srv/http

wget: http://download.owncloud.org/community/owncloud-6.0.2.tar.bz2

tar xvf owncloud-6.0.2.tar.bz2


그룹, 유저 추가 및 권한설정

groupadd www-data
adduser www-data
chown -R www-data:www-data owncloud

config.php 수정
 'datadirectory' => '/srv/http/owncloud/data',
 'dbtype' => 'mysql',
 'dbname' => 'owncloud',
 'dbhost' => 'localhost',

사설인증서 만들기 위치: /etc/nginx
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key 
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

*nginx가 가볍다고해서 첨으로 설치해보았는데
아파치에 비해 하나하나 설정할게 많아서 진짜 멘붕;
서버실행시 로케일오류가 나길래


owncloud locale failed



/etc/locale.gen에 모두 추가하니 해결;;
*라즈비안에서는 db를 별도로 만들지 않아도 기존계정으로 로그인이 가능했었는데
아치리눅스는 안 만들어주니 아예 화면도 안나옴
처음에 owncloud 버전을 5.0으로로 설치했을때는 data폴더가 없었음
만들어주고 소유권 및 권한을 줌

chown www-data:www-data /srv/http/owncloud/data
chown -R  /srv/http/owncloud/data
chmod -R 770  /srv/http/owncloud/data


Posted by 동화미소
   
,