Centos7-Redmine-Nginx-Passenger-Https安装

1.1 Step 1 - Redmine application
wget http://www.redmine.org/releases/redmine-3.1.2.tar.gz
cp redmine-3.1.2.tar.gz /var/www
cd /var/www
tar -zxf redmine-3.1.2.tar.gz
mv redmine-3.1.2 dcproject
cd dcproject/

1.2 Step 2 - Create an empty database and accompanying user
yum -y install mariadb-server mariadb

systemctl enable mariadb.service

mysql_secure_installation

mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

1.3 Step 3 - Database connection configuration
cp config/database.yml.example config/database.yml
vim config/database.yml

production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: my_password
encoding: utf8

1.4 Step 4 - Dependencies installation
yum install gem rubygems
yum install libxml2-devel zlib-devel ruby-devel mariadb-devel ImageMagick-devel libcurl-devel
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem install bundler


bundle install --without development test

1.5 Step 5 - Session store secret generation
bundle exec rake generate_secret_token

1.6 Step 6 - Database schema objects creation
RAILS_ENV=production bundle exec rake db:migrate

1.7 Step 7 - Database default data set
RAILS_ENV=production bundle exec rake redmine:load_default_data
zh

1.8 Step 8 - File system permissions
E.g., assuming you run the application with a redmine user account:
mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R redmine:redmine files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

1.9 Step 9 - Test the installation
bundle exec rails server webrick -e production
http://localhost:3000/

1.10 Step 10 - Logging into the application¶
login: admin
password: admin

tcpdump -i enp3s0f1 -nn port 636 and -i enp3s0f1 -nn port 636

1.11 Step 11 - Web Server
gem install passenger
passenger-install-nginx-module

--------------------------------------------

Nginx with Passenger support was successfully installed.

The Nginx configuration file (/opt/nginx/conf/nginx.conf)
must contain the correct configuration options in order for Phusion Passenger
to function correctly.

This installer has already modified the configuration file for you! The
following configuration snippet was inserted:

http {
...
passenger_root /usr/local/share/gems/gems/passenger-5.0.21;
passenger_ruby /usr/bin/ruby;
...
}

After you start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.

1.12 Step 12 - 在centos7版本下增加nginx service

vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecStop=/opt/nginx/sbin/nginx -s stop
ExecReload=/opt/nginx/sbin/nginx -s reload
KillMode=process
KillSignal=SIGQUIT
TimeoutStopSec=5
PrivateTmp=true

[Install]
WantedBy=multi-user.target

[root@iZ23bk3nbo2Z dcproject]# systemctl enable nginx.service

1.13 Step 13 - Configure nginx run redmine
vim /opt/nginx/conf/nginx.conf
增加一行在后面,如:
passenger_root /usr/local/share/gems/gems/passenger-5.0.21;
passenger_ruby /usr/bin/ruby;
passenger_app_env production;
注释并修改如下:
# location / {
# root html;
# index index.html index.htm;
# }

root /var/www/dcproject/public;
passenger_enabled on;

重启服务:
[root@iZ23bk3nbo2Z dcproject]# systemctl restart nginx.service
redmineadmin/redmineserver168
1.14 Step 13 - Configure nginx https run redmine
vim /opt/nginx/conf/nginx.conf
增加如下内容:
server {
server_name project.dcnet.com;
listen 443;
ssl on;
ssl_certificate /opt/nginx/cacerts/project.crt;
ssl_certificate_key /opt/nginx/cacerts/project.key;
1.15 Step 14 - Configure redmine mail发送通知
cd /var/www/dcproject/config
cp configuration.yml.example configuration.yml
vim configuration.yml
修改如下:

default:
# Outgoing emails configuration
# See the examples below and the Rails guide for more configuration options:
# http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.dcnet.com
port: 25
domain: dcnet.com
authentication: :login
user_name: dc
password: dckj168

重启服务:
systemctl restart nginx.service

posted @ 2015-11-20 12:04  达摩子  阅读(2287)  评论(0编辑  收藏  举报