mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Removed ~
Former-commit-id: 29eee59130b02f9bb9033138ee052ba720fcda1e [formerly 3d90801f2a731afebef1cdb915ab118096ce8469] [formerly b28d4c4de6b0de9f947a45a1430a79fbb31ae037 [formerly e04fe77c12
]]
Former-commit-id: 00c07b3e06b9dec926f7c6c7fcef8fce0ec15f8a [formerly f7ac93a564315020dcc807bff0a447ace7ce5960]
Former-commit-id: dac8f850c3a3fbbc6a4235b99b541983628db263
This commit is contained in:
parent
57d0e3cd87
commit
c789b56966
@ -1,31 +0,0 @@
|
||||
ADDRESS = yourserver.com
|
||||
PORT = 8003
|
||||
|
||||
CUR_DIR = $(shell bash -c 'pwd')
|
||||
USERCUR = $(shell bash -c 'whoami')
|
||||
|
||||
make:
|
||||
go build
|
||||
|
||||
install:
|
||||
rm -rf jinstall
|
||||
mkdir jinstall
|
||||
cp awwkoala.ssl.nginx awwkoala.ssl.nginx.temp
|
||||
sed -i 's/PORT/$(PORT)/g' awwkoala.ssl.nginx.temp
|
||||
sed -i 's/ADDRESS/$(ADDRESS)/g' awwkoala.ssl.nginx.temp
|
||||
sed -i 's^CUR_DIR^$(CUR_DIR)^g' awwkoala.ssl.nginx.temp
|
||||
cp awwkoala.init awwkoala.init.temp
|
||||
sed -i 's/EXT_ADDRESS/$(ADDRESS)/g' awwkoala.init.temp
|
||||
sed -i 's^CUR_DIR^$(CUR_DIR)^g' awwkoala.init.temp
|
||||
sed -i 's^USERCUR^$(USERCUR)^g' awwkoala.init.temp
|
||||
sed -i 's^PORT^$(PORT)^g' awwkoala.init.temp
|
||||
cp awwkoala.init.temp /etc/init.d/awwkoala.init
|
||||
chmod +x /etc/init.d/awwkoala.init
|
||||
cp awwkoala.ssl.nginx.temp /etc/nginx/sites-available/awwkoala.nginx
|
||||
ln -fs /etc/nginx/sites-available/awwkoala.nginx /etc/nginx/sites-enabled/awwkoala.nginx
|
||||
/etc/init.d/nginx reload
|
||||
/etc/init.d/nginx restart
|
||||
/etc/init.d/awwkoala.init restart
|
||||
rm -rf *.temp
|
||||
|
||||
.PHONY: install
|
@ -1,17 +0,0 @@
|
||||
First install the NGINX block in this directory. (There is an experimental Makefile that will do this, just try `sudo make install`.
|
||||
|
||||
To use letsencrypt follow these steps:
|
||||
|
||||
```
|
||||
git clone https://github.com/letsencrypt/letsencrypt
|
||||
cd letsencrypt
|
||||
sudo service nginx stop
|
||||
sudo ./letsencrypt-auto certonly --standalone --email youremail@somewhere.com -d yourserver.com
|
||||
sudo service nginx start
|
||||
```
|
||||
|
||||
Then startup `awwkoala` with
|
||||
|
||||
```bash
|
||||
sudo ./awwkoala -p :8001 -key /etc/letsencrypt/live/yourserver.com/privkey.pem -crt /etc/letsencrypt/live/yourserver.com/cert.pem yourserver.com
|
||||
```
|
@ -1,101 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: awwkoala
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start daemon at boot time
|
||||
# Description: Enable service provided by daemon.
|
||||
### END INIT INFO
|
||||
|
||||
# This should be placed in /etc/init.d directory
|
||||
# start with
|
||||
# sudo /etc/init.d/awwkoala start
|
||||
# stop with
|
||||
# sudo /etc/init.d/awwkoala start
|
||||
|
||||
dir="CUR_DIR"
|
||||
user="USERCUR"
|
||||
cmd="./awwkoala -p :PORT -key /etc/letsencrypt/live/EXT_ADDRESS/privkey.pem -crt /etc/letsencrypt/live/EXT_ADDRESS/cert.pem yourserver.com./awwkoala EXT_ADDRESS"
|
||||
|
||||
name="awwkoala"
|
||||
pid_file="/var/run/$name.pid"
|
||||
stdout_log="/var/log/$name.log"
|
||||
stderr_log="/var/log/$name.err"
|
||||
|
||||
get_pid() {
|
||||
cat "$pid_file"
|
||||
}
|
||||
|
||||
is_running() {
|
||||
[ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if is_running; then
|
||||
echo "Already started"
|
||||
else
|
||||
echo "Starting $name"
|
||||
cd "$dir"
|
||||
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
|
||||
echo $! > "$pid_file"
|
||||
if ! is_running; then
|
||||
echo "Unable to start, see $stdout_log and $stderr_log"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if is_running; then
|
||||
echo -n "Stopping $name.."
|
||||
kill `get_pid`
|
||||
for i in {1..10}
|
||||
do
|
||||
if ! is_running; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
|
||||
if is_running; then
|
||||
echo "Not stopped; may still be shutting down or shutdown may have failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Stopped"
|
||||
if [ -f "$pid_file" ]; then
|
||||
rm "$pid_file"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Not running"
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
if is_running; then
|
||||
echo "Unable to stop, will not attempt to start"
|
||||
exit 1
|
||||
fi
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
if is_running; then
|
||||
echo "Running"
|
||||
else
|
||||
echo "Stopped"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -1,50 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name ADDRESS;
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
server {
|
||||
# SERVER BLOCK FOR ADDRESS
|
||||
listen 443 ssl;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_certificate /etc/letsencrypt/live/ADDRESS/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/ADDRESS/privkey.pem;
|
||||
|
||||
access_log /etc/nginx/logs/access-ADDRESS.log;
|
||||
error_log /etc/nginx/logs/error-ADDRESS.log info;
|
||||
root CUR_DIR;
|
||||
server_name ADDRESS;
|
||||
|
||||
# Media: images, icons, video, audio, HTC
|
||||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
|
||||
expires 1M;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
# CSS and Javascript
|
||||
location ~* \.(?:css|js)$ {
|
||||
expires 1y;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
location ^~ /static {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location ~ ^/ {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
proxy_pass https://127.0.0.1:PORT;
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user