diff --git a/data/infra/examples/apache-vhost.conf b/data/infra/examples/apache-vhost.conf new file mode 100644 index 00000000..fbb7a18a --- /dev/null +++ b/data/infra/examples/apache-vhost.conf @@ -0,0 +1,11 @@ + + ServerName doma.in + DocumentRoot "/path/to/shlink/public" + + + Options FollowSymLinks Includes ExecCGI + AllowOverride all + Order allow,deny + Allow from all + + diff --git a/data/infra/examples/nginx-vhost.conf b/data/infra/examples/nginx-vhost.conf new file mode 100644 index 00000000..fa607c1d --- /dev/null +++ b/data/infra/examples/nginx-vhost.conf @@ -0,0 +1,22 @@ +server { + server_name doma.in; + listen 80; + root /path/to/shlink/public; + index index.php; + charset utf-8; + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; + fastcgi_index index.php; + include fastcgi.conf; + } + + location ~ /\.ht { + deny all; + } +} diff --git a/data/infra/examples/shlink-daemon.sh b/data/infra/examples/shlink-daemon.sh new file mode 100644 index 00000000..86b1257d --- /dev/null +++ b/data/infra/examples/shlink-daemon.sh @@ -0,0 +1,54 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: shlink_swoole +# Required-Start: $local_fs $network $named $time $syslog +# Required-Stop: $local_fs $network $named $time $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: Shlink non-blocking server with swoole +### END INIT INFO + +SCRIPT=/path/to/shlink/vendor/bin/zend-expressive-swoole\ start +RUNAS=root + +PIDFILE=/var/run/shlink_swoole.pid +LOGDIR=/var/log/shlink +LOGFILE=${LOGDIR}/shlink_swoole.log + +start() { + if [[ -f "$PIDFILE" ]] && kill -0 $(cat "$PIDFILE"); then + echo 'Shlink with swoole already running' >&2 + return 1 + fi + echo 'Starting shlink with swoole' >&2 + mkdir -p "$LOGDIR" + touch "$LOGFILE" + local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" + su -c "$CMD" $RUNAS > "$PIDFILE" + echo 'Shlink started' >&2 +} + +stop() { + if [[ ! -f "$PIDFILE" ]] || ! kill -0 $(cat "$PIDFILE"); then + echo 'Shlink with swoole not running' >&2 + return 1 + fi + echo 'Stopping shlink with swoole' >&2 + kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" + echo 'Shlink stopped' >&2 +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" +esac