sayem314 / Caddy-Web-Server-Installer

Script to manage Caddy web server
MIT License
210 stars 85 forks source link

Plugin Support? #15

Closed revunix closed 7 years ago

revunix commented 7 years ago

Hey

is it possible to add plugin support? i want to use the filemanager from caddy.

sayem314 commented 7 years ago

Yes possible. Will push a commit and notify you :)

sayem314 commented 7 years ago

@revunix try this now: caddy install http.filemanager After installing edit your Caddyfile according to your needs from /etc/Caddyfile

revunix commented 7 years ago

Cool but after updating, nothing won't work. I can't start etc.

Debian 9

root@unix:~# caddy version

  Caddy Web Server 0.10.6
  Caddy Web Server Installer - v5.4 (05 Aug 2017)
  PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )

tried a reinstall but... nope

root@unix:~# wget https://git.io/vra5C -O - -o /dev/null|bash

  Setting up Caddy
  Done. run 'caddy' to use Caddy

root@unix:~#
root@unix:~# caddy install

  Downloading Caddy Web Server for (64bit)...  [DONE]

  Extracting Caddy Web Server to /opt/caddyserver... [DONE]

  Are you gonna run php site? [y/N]: y
  Installing required php files...root@unix:~#
root@unix:~#

on my other server (Ubuntu) works... strange.

root@unix:~# caddy install http.filemanager

  Downloading Caddy Web Server for (64bit)...  [DONE]

  Extracting Caddy Web Server to /opt/caddyserver... [DONE]

  Are you gonna run php site? [y/N]: y
  Installing required php files...  [DONE]
  Fixing php...  [DONE]
  Creating user 'caddy'
useradd: user 'caddy' already exists
  Binding port using setcap...  [DONE]
  Service already exists! Skipped.
  Caddyfile found. Skip...
  index.html found. Skip ...

  Done. Caddy has been installed :)
  Run caddy start to start Caddy Web Server

root@unix:~# caddy version

  Caddy Web Server 0.10.6
  Caddy Web Server Installer - v4.9 (15 Jul 2017)
  PHP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS )

root@unix:~#
sayem314 commented 7 years ago

Apparently set -e was an bad idea for this script. See: https://github.com/sayem314/Caddy-Web-Server-Installer/blob/67c35c20cefaa42f2655a36bb581174f330a7137/caddy#L19

I'll push an update within next few hrs with some additional updates. And on your Ubuntu machine you're using a very older version of this script, I suggest you to update the script.

Bitti09 commented 7 years ago

@sayem314 what timezone do you live in? it seems to be +1day timezone cause @revunix is using the script version dated 05 Aug 2017 and your last commit was 20 hours ago

sayem314 commented 7 years ago

@Bitti09 did you see Caddy Web Server Installer - v4.9 (15 Jul 2017)?

See last output on this comment

Bitti09 commented 7 years ago

@sayem314 the problem exist on his Debian 9 server, the old server was posted for comparing.

sayem314 commented 7 years ago

@Bitti09 yes right. I'm working on it, already fixed tho but need to work on additional command. Should push an update within hrs!

revunix commented 7 years ago

@sayem314 Install on newest Ubuntu 16.04 ... same error with set -e

sayem314 commented 7 years ago

@revunix pushed and update. plz check newer version (5.5 or later) and let me know if this is fixed :)

revunix commented 7 years ago

Tried on Debian 9, fresh install.

root@ns3082284:~# caddy install http.login,http.filemanager

  Downloading Caddy Web Server with plugin (http.login,http.filemanager) for (64bit)...  [DONE]

  Extracting Caddy Web Server to /opt/caddyserver... [DONE]

  Are you gonna run php site? [y/N]: y
  Installing required php files.../usr/local/bin/caddy: line 395: [[: 9
9: syntax error in expression (error token is "9")
/usr/local/bin/caddy: line 404: [[: 9
9: syntax error in expression (error token is "9")
  [DONE]
  Installed 'php5-fpm php5-cli php5-curl curl sudo'
  Fixing php sock issue...  [FAILED]
  php not found!

  User 'caddy' already exists! Skipped.
  Binding port using setcap...  [DONE]
  Service already exists! Skipped.

  Enter your domain name
  Seperated by comma
  Domain name: ^C
root@ns3082284:~# caddy -v

  Caddy Web Server 0.10.6
  Caddy Web Server Installer - v5.5 (06 Aug 2017)
  PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )

root@ns3082284:~#
sayem314 commented 7 years ago

Please provide me your output of: cat /etc/*-release | grep "VERSION_ID=" | cut -f1 -d'.'| cut -f2 -d'"' lsb_release -i | awk 'NF{ print $NF }'

revunix commented 7 years ago

root@ns3082284:~# cat /etc/*-release | grep "VERSION_ID=" | cut -f1 -d'.'| cut -f2 -d'"'
9
9
root@ns3082284:~# lsb_release -i | awk 'NF{ print $NF }'
Debian
sayem314 commented 7 years ago

Weird! Working on my fresh VM.

Debian 9.1 on DigitalOcean

revunix commented 7 years ago

Okay this is very weird... on my second server (Debian 8 to 9 upgrade fresh)


root@unix:~# caddy install http.login,http.filemanager

  Downloading Caddy Web Server with plugin (http.login,http.filemanager) for (64bit)...  [DONE]

  Extracting Caddy Web Server to /opt/caddyserver... [DONE]

  Are you gonna run php site? [y/N]: y
  Installing required php files...  [DONE]
  Installed 'php7.0-fpm php7.0-cli php7.0-curl curl sudo'
  Fixing php sock issue...  [DONE]
  Creating user 'caddy'
  Binding port using setcap...  [DONE]
  Creating service...  DONE

Created symlink /etc/systemd/system/multi-user.target.wants/caddy.service → /etc/systemd/system/caddy.service.

  Enter your domain name
  Seperated by comma
  Domain name: u.unix.wtf

  Enter your email for automated ssl
  Email: mail@gmail.com

  /etc/Caddyfile created
  index.html created
  PHP-info file created
  /var/caddywww/info.php

  Done. Caddy has been installed :)
  Run caddy start to start Caddy Web Server

root@unix:~# caddy start
  Starting Caddy Web Server...  [DONE]

  Caddy Web Server is running
  Caddy (PID: 22155) is using 13MB RAM
  System available RAM 540MB
  Uptime - 2 seconds

root@unix:~#
sayem314 commented 7 years ago

Looks good now. I think you need to debug your previous OS since it's something wrong with your OS.

revunix commented 7 years ago

oh dear... your script is strange...

php not found... okay than

root@ns3082284:~# php -v
PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.19-1, Copyright (c) 1999-2017, by Zend Technologies

than i found a apache2 part and deleted them. apt remove apache*

than next try

root@ns3082284:~# caddy delete

  Are you sure you want to uninstall Caddy web server? [y/N]
  Select an option: y
  Shutting down Caddy Web Server...  [DONE]
  Caddy Web Server has been deleted.

  Would you also like to delete /var/caddywww (data)? [y/N]: y

  Deleting /var/caddywww (data)...  [DONE]
  Caddy user 'caddy' has been deleted too.

/usr/local/bin/caddy: line 763: /opt/caddyserver/update.check: No such file or directory
root@ns3082284:~# caddy install

  Downloading Caddy Web Server for (64bit)...  [DONE]

  Extracting Caddy Web Server to /opt/caddyserver... [DONE]

  Are you gonna run php site? [y/N]: y
  Installing required php files.../usr/local/bin/caddy: line 395: [[: 9
9: syntax error in expression (error token is "9")
/usr/local/bin/caddy: line 404: [[: 9
9: syntax error in expression (error token is "9")
  [DONE]
  Installed 'php5-fpm php5-cli php5-curl curl sudo'
  Fixing php sock issue...  [DONE]
  Creating user 'caddy'
  Binding port using setcap...  [DONE]
  Creating service...  DONE

Created symlink /etc/systemd/system/multi-user.target.wants/caddy.service → /etc/systemd/system/caddy.service.

  Enter your domain name
  Seperated by comma
  Domain name: unix.wtf

  Enter your email for automated ssl
  Email: mail@me.com

  /etc/Caddyfile created
  index.html created
  PHP-info file created
  /var/caddywww/info.php

  Done. Caddy has been installed :)
  Run caddy start to start Caddy Web Server

root@ns3082284:~# caddy start
  Starting Caddy Web Server...  [DONE]

  Caddy Web Server is running
  Caddy (PID: 14962) is using 16MB RAM
  System available RAM 1.4GB
  Uptime - 2 seconds

root@ns3082284:~#

very strange...

https://u.unix.wtf/info.php https://unix.wtf/info.php (bug server)

sayem314 commented 7 years ago

Yeah strange. I'm not sure why this error happening, but I've tried on 3 different Debian 9 VM and there is no error on my side.

Bitti09 commented 7 years ago

@sayem314 see #16