├── LICENSE ├── README.md ├── config.yml ├── gotifypush-le-ssl.conf ├── gotifypush.conf ├── gotifypush.service ├── start.sh └── upgrade.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Santhosh Veer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gotify Apache 2 | 3 | Install and Configure Gotify without Docker in Apache Server. 4 | 5 | ## Requirements 6 | 7 | - Ubuntu 18.04 64bit LTS 8 | - Apache 9 | - MYSQL 10 | 11 | ## Installation 12 | 13 | - create new user 14 | 15 | `Replace with your username | if you are already having an user in your server skip the user creation step` 16 | 17 | ```bash 18 | adduser 19 | ``` 20 | 21 | - Add superuser group permission to unlock admin privileges 22 | 23 | ```bash 24 | usermod -aG sudo 25 | ``` 26 | 27 | - Login as user 28 | 29 | ```bash 30 | su - 31 | ``` 32 | 33 | - Update the packages 34 | 35 | ```bash 36 | sudo apt-get update 37 | ``` 38 | 39 | ```bash 40 | sudo apt-get upgrade 41 | ``` 42 | 43 | - Create a Folder for Gotify Installation 44 | 45 | ```bash 46 | sudo mkdir -p /var/www/gotifypush 47 | ``` 48 | 49 | - Replace `` with the your username 50 | 51 | ```bash 52 | sudo chown : /var/www/gotifypush 53 | ``` 54 | 55 | - Set correct Folder Permision 56 | 57 | ```bash 58 | sudo chmod 775 /var/www/gotifypush 59 | ``` 60 | 61 | - Download Gotify 62 | 63 | ```bash 64 | cd /var/www/gotifypush 65 | ``` 66 | 67 | - Download Latest Binary File From the Github respo Release Page 68 | 69 | `Example` 70 | 71 | ```bash 72 | wget https://github.com/gotify/server/releases/download/v2.0.5/gotify-linux-amd64.zip 73 | ``` 74 | 75 | ```bash 76 | chmod +x gotify-linux-amd64 77 | ``` 78 | 79 | - Create a New File Named as `config.yml` 80 | 81 | ```bash 82 | sudo nano config.yml 83 | ``` 84 | 85 | - Just add this Below Configuration 86 | 87 | > Leave `ssl` Settings | Add your domain in `stream` settings | Add your Database user and Pass in `database` settings | Update your Account Admin User & pass in `defaultuser` settings also update your gotify installation Directory. 88 | 89 | ```yml 90 | # Example configuration file for the server. 91 | # Save it to `config.yml` when edited 92 | 93 | server: 94 | listenaddr: "" # the address to bind on, leave empty to bind on all addresses 95 | port: 9000 # the port the HTTP server will listen on 96 | 97 | ssl: 98 | enabled: false # if https should be enabled 99 | redirecttohttps: false # redirect to https if site is accessed by http 100 | listenaddr: "" # the address to bind on, leave empty to bind on all addresses 101 | port: 443 # the https port 102 | certfile: # the cert file (leave empty when using letsencrypt) 103 | certkey: # the cert key (leave empty when using letsencrypt) 104 | letsencrypt: 105 | enabled: false # if the certificate should be requested from letsencrypt 106 | accepttos: false # if you accept the tos from letsencrypt 107 | cache: # the directory of the cache from letsencrypt 108 | hosts: # the hosts for which letsencrypt should request certificates 109 | - push.example.com 110 | 111 | responseheaders: # response headers are added to every response (default: none) 112 | Strict-Transport-Security: max-age=31536000 113 | X-Xss-Protection: 1; mode=block 114 | 115 | cors: # Sets cors headers only when needed and provides support for multiple allowed origins. Overrides Access-Control-* Headers in response headers. 116 | alloworigins: 117 | # - "example.com" 118 | allowmethods: 119 | # - "GET" 120 | # - "POST" 121 | allowheaders: 122 | # - "Authorization" 123 | # - "content-type" 124 | 125 | stream: 126 | allowedorigins: # allowed origins for websocket connections (same origin is always allowed) 127 | # - ".+.example.com" 128 | # - "push.example.com" 129 | 130 | database: # for database see (configure database section) 131 | dialect: mysql 132 | connection: root:DBPASS@tcp(127.0.0.1)/gotifydb?charset=utf8&parseTime=True&loc=Local 133 | 134 | defaultuser: # on database creation, gotify creates an admin user 135 | name: admin # the username of the default user 136 | pass: admin # the password of the default user 137 | passstrength: 10 # the bcrypt password strength (higher = better but also slower) 138 | uploadedimagesdir: /var/www/gotifypush/data/images # the directory for storing uploaded images 139 | pluginsdir: /var/www/gotifypush/data/plugins # the directory where plugin resides 140 | ``` 141 | 142 | ### Note Point 143 | 144 | If you Enable Firewall on your server allow the port `9000` and Don't Forget to Create a Database - Create a New database in MYSQL Named as `gotifydb`. 145 | 146 | - Next Create a New bash file named as `start.sh` in the Gotify Installed directory 147 | 148 | ```bash 149 | #!/bin/bash 150 | 151 | ./gotify-linux-amd64 152 | ``` 153 | 154 | ```bash 155 | chmod +x start.sh 156 | ``` 157 | 158 | - Over all File listing in Gotify Installation Folder `var/www/gotifypush` 159 | 160 | ```bash 161 | - config.yml 162 | - start.sh 163 | - gotify-linux-amd64 164 | ``` 165 | 166 | - Create a Vhost for Gotify 167 | - Apache VHost Configuration for HTTP 168 | 169 | ```bash 170 | sudo nano /etc/apache2/sites-available/gotifypush.conf 171 | ``` 172 | 173 | `gotifypush.conf` 174 | 175 | ```bash 176 | 177 | 178 | # The ServerName directive sets the request scheme, hostname and port that 179 | # the server uses to identify itself. This is used when creating 180 | # redirection URLs. In the context of virtual hosts, the ServerName 181 | # specifies what hostname must appear in the request's Host: header to 182 | # match this virtual host. For the default virtual host (this file) this 183 | # value is not decisive as it is used as a last resort host regardless. 184 | # However, you must set it for any further virtual host explicitly. 185 | 186 | ServerName push.example.com 187 | ServerAdmin webmaster@localhost 188 | DocumentRoot /var/www/gotifypush 189 | Keepalive On 190 | 191 | # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 192 | # error, crit, alert, emerg. 193 | # It is also possible to configure the loglevel for particular 194 | # modules, e.g. 195 | #LogLevel info ssl:warn 196 | 197 | ErrorLog ${APACHE_LOG_DIR}/error.log 198 | CustomLog ${APACHE_LOG_DIR}/access.log combined 199 | 200 | # For most configuration files from conf-available/, which are 201 | # enabled or disabled at a global level, it is possible to 202 | # include a line for only one particular virtual host. For example the 203 | # following line enables the CGI configuration for this host only 204 | # after it has been globally disabled with "a2disconf". 205 | #Include conf-available/serve-cgi-bin.conf 206 | 207 | RewriteEngine on 208 | RewriteCond %{SERVER_NAME} =push.example.com 209 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] 210 | 211 | ProxyPreserveHost On 212 | ProxyRequests off 213 | #ProxyVia Full 214 | 215 | # Proxy web socket requests to /stream 216 | ProxyPass "/stream" ws://127.0.0.1:9000/ retry=0 timeout=5 217 | # Proxy all other requests to / 218 | ProxyPass "/" http://127.0.0.1:9000/ retry=0 timeout=5 219 | ProxyPassReverse / http://127.0.0.1:9000/ 220 | 221 | 222 | 223 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 224 | ``` 225 | 226 | - Enable Vhost 227 | 228 | ```bash 229 | sudo a2ensite gotifypush.conf 230 | ``` 231 | 232 | - For SSL Use `https://certbot.eff.org/` (While a Creating SSL via Cetbot Select `NO` for Force SSL(HTTPS) Redirection Because already I added the Rewrite Rule for HTTPS Force Redirection) 233 | - Vhost Configuration for HTTPS (Actually It will Automatically Created by `certbot` but we need to Add some Extra Configuration to use Gotify/Server via HTTPS) 234 | 235 | ```bash 236 | sudo nano /etc/apache2/sites-available/gotifypush-le-ssl.conf 237 | ``` 238 | 239 | `gotifypush-le-ssl.conf` 240 | 241 | ```bash 242 | 243 | 244 | # The ServerName directive sets the request scheme, hostname and port that 245 | # the server uses to identify itself. This is used when creating 246 | # redirection URLs. In the context of virtual hosts, the ServerName 247 | # specifies what hostname must appear in the request's Host: header to 248 | # match this virtual host. For the default virtual host (this file) this 249 | # value is not decisive as it is used as a last resort host regardless. 250 | # However, you must set it for any further virtual host explicitly. 251 | 252 | ServerName push.example.com 253 | ServerAdmin webmaster@localhost 254 | DocumentRoot /var/www/gotifypush 255 | Keepalive On 256 | 257 | # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 258 | # error, crit, alert, emerg. 259 | # It is also possible to configure the loglevel for particular 260 | # modules, e.g. 261 | #LogLevel info ssl:warn 262 | 263 | ErrorLog ${APACHE_LOG_DIR}/error.log 264 | CustomLog ${APACHE_LOG_DIR}/access.log combined 265 | 266 | # For most configuration files from conf-available/, which are 267 | # enabled or disabled at a global level, it is possible to 268 | # include a line for only one particular virtual host. For example the 269 | # following line enables the CGI configuration for this host only 270 | # after it has been globally disabled with "a2disconf". 271 | #Include conf-available/serve-cgi-bin.conf 272 | 273 | SSLProxyEngine On 274 | SSLProxyVerify require 275 | SSLProxyCheckPeerName On 276 | SSLCertificateFile /etc/letsencrypt/live/push.example.com/fullchain.pem 277 | SSLCertificateKeyFile /etc/letsencrypt/live/push.example.com/privkey.pem 278 | Include /etc/letsencrypt/options-ssl-apache.conf 279 | 280 | RewriteEngine on 281 | RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] 282 | RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC] 283 | RewriteRule .* ws://127.0.0.1:9000%{REQUEST_URI} [P] 284 | 285 | ProxyPreserveHost On 286 | ProxyRequests off 287 | #ProxyVia Full 288 | 289 | # Proxy web socket requests to /stream 290 | ProxyPass "/stream" ws://127.0.0.1:9000/ retry=0 timeout=5 291 | # Proxy all other requests to / 292 | ProxyPass "/" http://127.0.0.1:9000/ retry=0 timeout=5 293 | ProxyPassReverse / http://127.0.0.1:9000/ 294 | 295 | 296 | 297 | ``` 298 | 299 | ```bash 300 | sudo service apache2 restart 301 | ``` 302 | 303 | - After all setup open Gotify Root Folder `var/www/gotifypush` 304 | - Run the Gotify & test the MYSQL database connection 305 | 306 | ```bash 307 | ./gotify-linux-amd64 308 | ``` 309 | 310 | - If the Test Passed Successfully Press CTRL + C to Stop the gotify/server 311 | - Setup systemd service to Run the Gotify/server Forever 312 | 313 | ```bash 314 | cd /etc/systemd/system 315 | ``` 316 | 317 | ```bash 318 | sudo nano gotifypush.service 319 | ``` 320 | 321 | `gotifypush.service` 322 | 323 | `Replace with the name of your user who will own this directory` 324 | 325 | ```bash 326 | [Unit] 327 | Description=Start Gotify - a simple server for sending and receiving messages 328 | Requires=network.target 329 | After=network.target 330 | 331 | [Service] 332 | Type=simple 333 | User= 334 | WorkingDirectory=/var/www/gotifypush 335 | ExecStart=/bin/bash /var/www/gotifypush/start.sh 336 | Restart=always 337 | RestartSec=3 338 | 339 | [Install] 340 | WantedBy=multi-user.target 341 | ``` 342 | 343 | - CTRL + X & Enter to save the Service file Configuration 344 | - Next Enable the systemd service for Gotify server 345 | 346 | ```bash 347 | sudo systemctl daemon-reload 348 | ``` 349 | 350 | ```bash 351 | sudo systemctl enable gotifypush 352 | ``` 353 | 354 | ```bash 355 | sudo systemctl start gotifypush 356 | ``` 357 | 358 | - Check status 359 | 360 | ```bash 361 | sudo systemctl status gotifypush 362 | ``` 363 | 364 | - Restart 365 | 366 | ```bash 367 | sudo systemctl restart gotifypush 368 | ``` 369 | 370 | - That's Successfully we Install and Setup Gotify on Apache Server without Docker 371 | 372 | ## Update Gotify 373 | 374 | Update Gotify to the Latest Version - 375 | 376 | ## LICENSE 377 | 378 | MIT 379 | -------------------------------------------------------------------------------- /config.yml: -------------------------------------------------------------------------------- 1 | # Example configuration file for the server. 2 | # Save it to `config.yml` when edited 3 | 4 | server: 5 | listenaddr: "" # the address to bind on, leave empty to bind on all addresses 6 | port: 9000 # the port the HTTP server will listen on 7 | 8 | ssl: 9 | enabled: false # if https should be enabled 10 | redirecttohttps: false # redirect to https if site is accessed by http 11 | listenaddr: "" # the address to bind on, leave empty to bind on all addresses 12 | port: 443 # the https port 13 | certfile: # the cert file (leave empty when using letsencrypt) 14 | certkey: # the cert key (leave empty when using letsencrypt) 15 | letsencrypt: 16 | enabled: false # if the certificate should be requested from letsencrypt 17 | accepttos: false # if you accept the tos from letsencrypt 18 | cache: # the directory of the cache from letsencrypt 19 | hosts: # the hosts for which letsencrypt should request certificates 20 | - push.example.com 21 | 22 | responseheaders: # response headers are added to every response (default: none) 23 | Strict-Transport-Security: max-age=31536000 24 | X-Xss-Protection: 1; mode=block 25 | 26 | cors: # Sets cors headers only when needed and provides support for multiple allowed origins. Overrides Access-Control-* Headers in response headers. 27 | alloworigins: 28 | # - "example.com" 29 | allowmethods: 30 | # - "GET" 31 | # - "POST" 32 | allowheaders: 33 | # - "Authorization" 34 | # - "content-type" 35 | 36 | stream: 37 | allowedorigins: # allowed origins for websocket connections (same origin is always allowed) 38 | # - ".+.example.com" 39 | # - "push.example.com" 40 | 41 | database: # for database see (configure database section) 42 | dialect: mysql 43 | connection: root:DBPASS@tcp(127.0.0.1)/gotifydb?charset=utf8&parseTime=True&loc=Local 44 | 45 | defaultuser: # on database creation, gotify creates an admin user 46 | name: admin # the username of the default user 47 | pass: admin # the password of the default user 48 | passstrength: 10 # the bcrypt password strength (higher = better but also slower) 49 | uploadedimagesdir: /var/www/gotifypush/data/images # the directory for storing uploaded images 50 | pluginsdir: /var/www/gotifypush/data/plugins # the directory where plugin resides -------------------------------------------------------------------------------- /gotifypush-le-ssl.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | # The ServerName directive sets the request scheme, hostname and port that 4 | # the server uses to identify itself. This is used when creating 5 | # redirection URLs. In the context of virtual hosts, the ServerName 6 | # specifies what hostname must appear in the request's Host: header to 7 | # match this virtual host. For the default virtual host (this file) this 8 | # value is not decisive as it is used as a last resort host regardless. 9 | # However, you must set it for any further virtual host explicitly. 10 | 11 | ServerName push.example.com 12 | ServerAdmin webmaster@localhost 13 | DocumentRoot /var/www/gotifypush 14 | Keepalive On 15 | 16 | # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 17 | # error, crit, alert, emerg. 18 | # It is also possible to configure the loglevel for particular 19 | # modules, e.g. 20 | #LogLevel info ssl:warn 21 | 22 | ErrorLog ${APACHE_LOG_DIR}/error.log 23 | CustomLog ${APACHE_LOG_DIR}/access.log combined 24 | 25 | # For most configuration files from conf-available/, which are 26 | # enabled or disabled at a global level, it is possible to 27 | # include a line for only one particular virtual host. For example the 28 | # following line enables the CGI configuration for this host only 29 | # after it has been globally disabled with "a2disconf". 30 | #Include conf-available/serve-cgi-bin.conf 31 | 32 | SSLProxyEngine On 33 | SSLProxyVerify require 34 | SSLProxyCheckPeerName On 35 | SSLCertificateFile /etc/letsencrypt/live/push.example.com/fullchain.pem 36 | SSLCertificateKeyFile /etc/letsencrypt/live/push.example.com/privkey.pem 37 | Include /etc/letsencrypt/options-ssl-apache.conf 38 | 39 | RewriteEngine on 40 | RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] 41 | RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC] 42 | RewriteRule .* ws://127.0.0.1:9000%{REQUEST_URI} [P] 43 | 44 | ProxyPreserveHost On 45 | ProxyRequests off 46 | #ProxyVia Full 47 | 48 | # Proxy web socket requests to /stream 49 | ProxyPass "/stream" ws://127.0.0.1:9000/ retry=0 timeout=5 50 | # Proxy all other requests to / 51 | ProxyPass "/" http://127.0.0.1:9000/ retry=0 timeout=5 52 | ProxyPassReverse / http://127.0.0.1:9000/ 53 | 54 | 55 | -------------------------------------------------------------------------------- /gotifypush.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | # The ServerName directive sets the request scheme, hostname and port that 4 | # the server uses to identify itself. This is used when creating 5 | # redirection URLs. In the context of virtual hosts, the ServerName 6 | # specifies what hostname must appear in the request's Host: header to 7 | # match this virtual host. For the default virtual host (this file) this 8 | # value is not decisive as it is used as a last resort host regardless. 9 | # However, you must set it for any further virtual host explicitly. 10 | 11 | ServerName push.example.com 12 | ServerAdmin webmaster@localhost 13 | DocumentRoot /var/www/gotifypush 14 | Keepalive On 15 | 16 | # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 17 | # error, crit, alert, emerg. 18 | # It is also possible to configure the loglevel for particular 19 | # modules, e.g. 20 | #LogLevel info ssl:warn 21 | 22 | ErrorLog ${APACHE_LOG_DIR}/error.log 23 | CustomLog ${APACHE_LOG_DIR}/access.log combined 24 | 25 | # For most configuration files from conf-available/, which are 26 | # enabled or disabled at a global level, it is possible to 27 | # include a line for only one particular virtual host. For example the 28 | # following line enables the CGI configuration for this host only 29 | # after it has been globally disabled with "a2disconf". 30 | #Include conf-available/serve-cgi-bin.conf 31 | 32 | RewriteEngine on 33 | RewriteCond %{SERVER_NAME} =push.example.com 34 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] 35 | 36 | ProxyPreserveHost On 37 | ProxyRequests off 38 | #ProxyVia Full 39 | 40 | # Proxy web socket requests to /stream 41 | ProxyPass "/stream" ws://127.0.0.1:9000/ retry=0 timeout=5 42 | # Proxy all other requests to / 43 | ProxyPass "/" http://127.0.0.1:9000/ retry=0 timeout=5 44 | ProxyPassReverse / http://127.0.0.1:9000/ 45 | 46 | 47 | 48 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet -------------------------------------------------------------------------------- /gotifypush.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Start Gotify - a simple server for sending and receiving messages 3 | Requires=network.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=simple 8 | User= 9 | WorkingDirectory=/var/www/gotifypush 10 | ExecStart=/bin/bash /var/www/gotifypush/start.sh 11 | Restart=always 12 | RestartSec=3 13 | 14 | [Install] 15 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./gotify-linux-amd64 4 | -------------------------------------------------------------------------------- /upgrade.md: -------------------------------------------------------------------------------- 1 | # Upgrade Gotify 2 | 3 | Update Gotify to the Latest Version 🌀 4 | 5 | ## Upgrade Process 6 | 7 | - Stop the Systemd Service 8 | 9 | ```bash 10 | sudo systemctl stop gotifypush 11 | ``` 12 | 13 | ```bash 14 | sudo systemctl daemon-reload 15 | ``` 16 | 17 | - Open the Gotify Installed Location 18 | 19 | ```bash 20 | cd /var/www/gotifypush 21 | ``` 22 | 23 | - Rename the Older version 24 | 25 | ```bash 26 | sudo mv gotify-linux-amd64 gotify-linux-amd64-old 27 | ``` 28 | 29 | - Download the Gotify Latest Version from the Github Release Page 30 | - Download via `wget` 31 | 32 | ```bash 33 | wget https://github.com/gotify/server/releases/download//gotify-linux-amd64.zip 34 | ``` 35 | 36 | ```bash 37 | unzip /gotify-linux-amd64.zip 38 | ``` 39 | 40 | - Give Execute Permission 41 | 42 | ```bash 43 | chmod +x gotify-linux-amd64 44 | ``` 45 | 46 | - Verify your Installation - you should see that your system is running the latest version of Gotify 47 | 48 | ```bash 49 | ./start.sh 50 | ``` 51 | 52 | - Remove the Downloaded assets & Older version of Gotify 53 | 54 | ```bash 55 | rm -rf gotify-linux-amd64.zip LICENSE licenses gotify-linux-amd64-old 56 | ``` 57 | 58 | - if your installation Test is passed Press CTRL + C to Stop & Start the systemd Service 59 | 60 | ```bash 61 | sudo systemctl start gotifypush 62 | ``` 63 | 64 | ```bash 65 | sudo systemctl daemon-reload 66 | ``` 67 | 68 | ```bash 69 | sudo systemctl restart gotifypush 70 | ``` 71 | 72 | ```bash 73 | sudo service apache2 restart 74 | ``` 75 | --------------------------------------------------------------------------------