new nginx config & updated ubuntu install manual

This commit is contained in:
André Bauer 2016-10-19 22:53:54 +02:00
parent b0d22d4c53
commit 685d933fa8
4 changed files with 75 additions and 212 deletions

View file

@ -1,147 +1,40 @@
# Installation on Ubuntu 12.04 Server
## With Apache mod_proxy / MySQL
# Installation on Ubuntu 16.04 Server
## With Nginx & MySQL
### Prerequisits
* apt-get install apt-get install curl git-core patch build-essential bison zlib1g-dev libssl-dev libxml2-dev libxml2-dev sqlite3 libsqlite3-dev autotools-dev libxslt1-dev libyaml-0-2 autoconf automake libreadline6-dev libyaml-dev libtool
### Prerequisites
* apt-get install curl git-core patch build-essential bison zlib1g-dev libssl-dev libxml2-dev libxml2-dev sqlite3 libsqlite3-dev autotools-dev libxslt1-dev libyaml-0-2 autoconf automake libreadline6-dev libyaml-dev libtool libgmp-dev libgdbm-dev libncurses5-dev pkg-config libffi-dev libmysqlclient-dev mysql-server nginx
* mysql --defaults-extra-file=/etc/mysql/debian.cnf -e "CREATE USER 'zammad'@'localhost' IDENTIFIED BY 'Your_Pass_Word!'; GRANT ALL PRIVILEGES ON zammad_prod.* TO 'zammad'@'localhost'; FLUSH PRIVILEGES;"
* ln -s /opt/zammad/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf
### Add User
* useradd zammad -m -s /bin/bash
* echo -e "export RAILS_ENV=development" >> /home/zammad/.bashrc
* su zammad
* cd ~
### Install Ruby & Rails
* curl -L https://get.rvm.io | bash -s stable
* source /home/zammad/.rvm/scripts/rvm
* echo "source /home/zammad/.rvm/scripts/rvm" >> /home/zammad/.bashrc
* rvm install ruby
* gem install rails therubyracer
### Apache Config
* vi /etc/apache2/sites-available/zammad
```
<VirtualHost *:80>
ServerName zammad.example.com
ServerAdmin yourmail@example.com
SuexecUserGroup "zammad" "zammad"
## don't loose time with IP address lookups
HostnameLookups Off
## needed for named virtual hosts
UseCanonicalName Off
## configures the footer on server-generated documents
ServerSignature Off
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from localhost
</Proxy>
ProxyPass /assets !
ProxyPass /favicon.ico !
ProxyPass /robots.txt !
ProxyPass / http://localhost:3000/
DocumentRoot "/var/www/zammad/public"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/zammad/public">
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
```
* rm /etc/apache2/sites-enabled/000-default
* ln -s /etc/apache2/sites-available/zammad /etc/apache2/sites-enabled/zammad
* ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
* ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
* ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load
* ln -s /etc/apache2/mods-available/suexec.load /etc/apache2/mods-enabled/suexec.load
* service apache2 restart
* useradd zammad -m -d /opt/zammad -s /bin/bash
* echo "export RAILS_ENV=production" >> /opt/zammad/.bashrc
### Get Zammad
* cd /var/www/zammad
* wget http://zammad.org/zammad-latest.tar.gz
* su zammad
* cd ~
* wget http://ftp.zammad.com/zammad-latest.tar.gz
* tar -xzf zammad-latest.tar.gz
### Edit Gemfile
* vi Gemfile
* uncomment
* gem 'libv8', '~> 3.11.8'
* gem 'execjs'
* gem 'therubyracer'
### Install zammad
* bundle install
* chown -R zammad:zammad /var/www/zammad
### Create Database
* mysql --defaults-file=/etc/mysql/debian.cnf -e "CREATE DATABASE zammad_prod DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE USER 'zammad'@'localhost' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON zammad_prod.* TO 'zammad'@'localhost'; FLUSH PRIVILEGES;"
* vi config/database.yml
* su zammad
* cd ~
* rake db:migrate
* rake db:seed
### Start Server
* rake assets:precompile
* puma -p 3000 # application web server
* script/websocket-server.rb start # non blocking websocket server
* script/scheduler.rb start # generate overviews on demand, just send changed data to browser
## Testinstallation for Developers via RVM / SQLite
### Prerequisits
* apt-get install apt-get install curl git-core patch build-essential bison zlib1g-dev libssl-dev libxml2-dev libxml2-dev sqlite3 libsqlite3-dev autotools-dev libxslt1-dev libyaml-0-2 autoconf automake libreadline6-dev libyaml-dev libtool
### Add User
* useradd zammad -m -s /bin/bash
* echo -e "export RAILS_ENV=development" >> /home/zammad/.bashrc
* su zammad
* cd ~
### Install Ruby & Rails
### Install Environnment
* gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
* curl -L https://get.rvm.io | bash -s stable
* source /home/zammad/.rvm/scripts/rvm
* echo "source /home/zammad/.rvm/scripts/rvm" >> /home/zammad/.bashrc
* rvm install ruby
* gem install rails therubyracer
### Get Zammad
* cd /var/www/zammad
* wget http://zammad.org/zammad-1.0.1.tar.gz
* tar -xzf zammad-1.0.1.tar.gz
### Edit Gemfile
* vi Gemfile
* uncomment
* gem 'libv8', '~> 3.11.8'
* gem 'execjs'
* gem 'therubyracer'
* source /opt/zammad/.rvm/scripts/rvm
* echo "source /opt/zammad/.rvm/scripts/rvm" >> /opt/zammad/.bashrc
* echo "rvm --default use 2.3.1" >> /opt/zammad/.bashrc
* rvm install 2.3.1
* gem install bundler
### Install zammad
* bundle install
* bundle install --without test development postgres
* cp config/database.yml.dist config/database.yml
* vi config/database.yml
* rake db:create
* rake db:migrate
* rake db:seed
* rake assets:precompile
* puma -p 3000 # application web server
* script/websocket-server.rb start # non blocking websocket server
* script/scheduler.rb start # generate overviews on demand, just send changed data to browser
### Start Zammad
* rails s -p 3000
* script/websocket-server.rb start
* script/scheduler.rb start

View file

@ -1,37 +0,0 @@
#
# this is the nginx config for zammad
# link this file in your /etc/nginx/sites-enabled via symlink
# (ln -s /opt/zammad/contrib/nginx-zammad.conf /etc/nginx/sites-enabled/zammad.conf)
#
server {
listen 80;
server_name your.domain.org;
root /opt/zammad/public;
access_log /var/log/nginx/zammad.access.log;
error_log /var/log/nginx/zammad.error.log;
client_max_body_size 50M;
upstream zammad {
server unix://opt/zammad/var/zammad.sock
}
location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
expires max;
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://localhost:6042;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://zammad;
}
}

View file

@ -0,0 +1,49 @@
#
# this is the nginx config for zammad
# link this file in your /etc/nginx/sites-enabled via symlink
# (ln -s /opt/zammad/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf)
#
upstream zammad {
server localhost:3000;
}
upstream zammad-websocket {
server localhost:6042;
}
server {
listen 80;
server_name zammad.intdmz.h1.mdd zammad.magix-support.net;
root /opt/zammad/public;
access_log /var/log/nginx/zammad.access.log;
error_log /var/log/nginx/zammad.error.log;
client_max_body_size 50M;
location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
expires max;
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 86400;
proxy_pass http://zammad-websocket;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://zammad;
gzip on;
gzip_types text/html text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
gzip_proxied any;
}
}

View file

@ -1,42 +0,0 @@
#
# this is the nginx config for zammad
# link this file in your sites-enabled via symlink (ln -s nginx-zammad.conf /etc/nginx/sites-enabled/zammad.conf)
#
server {
listen 80;
server_name your.domain.org;
root /opt/zammad/public;
access_log /var/log/nginx/zammad.access.log;
error_log /var/log/nginx/zammad.error.log;
client_max_body_size 50M;
location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
expires max;
}
# proxy all to app server
location / {
proxy_set_header Host $http_host;
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3000;
gzip on;
gzip_types text/html text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
gzip_proxied any;
}
# proxy web sockets to app server
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 86400;
proxy_pass http://localhost:6042;
}
}