From 685d933fa834d323a7211ccc774a73193b7e728c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Wed, 19 Oct 2016 22:53:54 +0200 Subject: [PATCH] new nginx config & updated ubuntu install manual --- README_Install_Ubuntu.md | 159 ++++------------------ contrib/nginx-zammad.conf | 37 ----- contrib/nginx/sites-available/zammad.conf | 49 +++++++ contrib/nginx/sites-enabled/zammad.conf | 42 ------ 4 files changed, 75 insertions(+), 212 deletions(-) delete mode 100644 contrib/nginx-zammad.conf create mode 100644 contrib/nginx/sites-available/zammad.conf delete mode 100644 contrib/nginx/sites-enabled/zammad.conf diff --git a/README_Install_Ubuntu.md b/README_Install_Ubuntu.md index f9965e0f2..1160b7146 100644 --- a/README_Install_Ubuntu.md +++ b/README_Install_Ubuntu.md @@ -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 - -``` - - 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 - - - Order deny,allow - Allow from localhost - - - ProxyPass /assets ! - ProxyPass /favicon.ico ! - ProxyPass /robots.txt ! - ProxyPass / http://localhost:3000/ - - DocumentRoot "/var/www/zammad/public" - - - Options FollowSymLinks - AllowOverride None - - - - Options FollowSymLinks - Order allow,deny - Allow from all - - - -``` - -* 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 diff --git a/contrib/nginx-zammad.conf b/contrib/nginx-zammad.conf deleted file mode 100644 index 152917247..000000000 --- a/contrib/nginx-zammad.conf +++ /dev/null @@ -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; - } -} diff --git a/contrib/nginx/sites-available/zammad.conf b/contrib/nginx/sites-available/zammad.conf new file mode 100644 index 000000000..0312cd54e --- /dev/null +++ b/contrib/nginx/sites-available/zammad.conf @@ -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; + } +} diff --git a/contrib/nginx/sites-enabled/zammad.conf b/contrib/nginx/sites-enabled/zammad.conf deleted file mode 100644 index d49b3bedc..000000000 --- a/contrib/nginx/sites-enabled/zammad.conf +++ /dev/null @@ -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; - } -}