summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8afc57a983388b03d2343fe0a3cc56d06db8d522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Maintainer: Zeph <zeph33@gmail.com>
pkgname=bizou
pkgver=1.7
pkgrel=1
pkgdesc="Bizou - a (french) KISS php image gallery"
arch=('any')
url="http://positon.org/bizou/"
license=('GPLv3')
depends=('php' 'php-gd')
makedepends=()
options=('!strip')
source=("http://positon.org/bizou/${pkgname}_v${pkgver}.tar.gz")
backup=('etc/webapps/bizou/config.php')
md5sums=('7ad2151722b65495d41eaf2e4b61508c')

package() {
	# install project
	install -o http -g http -d ${pkgdir}/usr/share/webapps/
	cp -a ${srcdir}/${pkgname} ${pkgdir}/usr/share/webapps/
	chown -R http:http ${pkgdir}/usr/share/webapps/${pkgname}

	# install config file
	install -d  ${pkgdir}/etc/webapps/${pkgname}

	# move config to /etc
	mv ${pkgdir}/usr/share/webapps/${pkgname}/config.php ${pkgdir}/etc/webapps/${pkgname}/config.php
	chown -R http:http ${pkgdir}/etc/webapps/${pkgname}/config.php
	ln -s /etc/webapps/${pkgname}/config.php ${pkgdir}/usr/share/webapps/${pkgname}/config.php
	cat >$pkgdir/etc/webapps/bizou/apache.example.conf <<EOF
		Alias /bizou "/usr/share/webapps/bizou"
		<Directory "/usr/share/webapps/bizou">
			AllowOverride All
			Options FollowSymlinks
			Order allow,deny
			Allow from all
			php_admin_value open_basedir "/srv/:/tmp/:/usr/share/webapps/:/etc/webapps:/usr/share/pear/"
		</Directory>
EOF
	cat >$pkgdir/etc/webapps/bizou/nginx.example.conf <<EOF
	# redirect http to https.
	server {
	  listen 80;
	  server_name bizou.example.org;
	  return 301 https://$server_name$request_uri;  # enforce https
	}

	# bizou (ssl/tls)
	server {
		listen 443 ssl;
		ssl_certificate /etc/nginx/certs/server.crt;
		ssl_certificate_key /etc/nginx/certs/server.key;
		server_name bizou.example.org;
		root /usr/share/webapps/bizou;
		index index.php;

		# deny direct access
		location ~ ^/(config|\.ht) {
			deny all;
		}
		access_log /var/log/nginx/stats.access.log;
		error_log /var/log/nginx/stats.error.log;

		# enable php
		location ~ \.php$ {
			fastcgi_pass 127.0.0.1:9000; # or use php-fpm with: "unix:/var/run/php-fpm/php-fpm.sock;"
			fastcgi_param HTTPS on;
			fastcgi_index index.php;
			include fastcgi.conf;
		}
	}
EOF

}