redmine 在 Windows7 安装过程简单记录(https方式访问)

概要的记录一下 Redmine 安装过程(https 方式访问)

随手记录而已。全部的安装方法,均来自网络上的各种信息汇集,+少许的自我发挥。

 

1

安装数据库,选择MySQL数据库

mysql-5.5.59-winx64.msi

 

2

安装ruby语言,下载安装工具 railsinstaller

railsinstaller-3.4.0.exe

以下步骤似乎是无用,复制文件:

d:\Program Files\MySQL\MySQL Server 5.5\lib\libmysql.dll

复制到

d:\RailsInstaller\Ruby2.3.3\bin

(附记:安装 rubyinstaller-devkit-2.4.4-1-x86.exe 也可以)

 

3

安装Redmine

直接解压redmine3.4.5.zip 到目录中 C:\Sites\redmine-3.4.5中.

 

4

启动MySQL

mysql -u root -p

 

显示:

C:\Users\Administrator>mysql -u root -p

Enter password: ***

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.5.59 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved..

mysql>

 

5

执行SQL脚本,创建&设置数据库

CREATE DATABASE redmine CHARACTER SET utf8;

CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';

GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

显示:

mysql> CREATE DATABASE redmine CHARACTER SET utf8;

Query OK, 1 row affected (0.03 sec)

 

mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';

Query OK, 0 rows affected (0.00 sec)

 

mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

Query OK, 0 rows affected (0.00 sec)

 

mysql>exit

 

6

配置MySQL数据库连接参数

创建配置文件:

C:\Sites\redmine-3.2.9\config\database.yml

输入如下的参数

production:

  adapter: mysql2

  database: redmine

  host: 127.0.0.1

  username: redmine

  password: my_password

保存文件

 

7

使用Ruby安装其他部分,将会遇到许多的坑。

执行:

gem install bundler

C:\Sites>gem install bundler

Fetching: bundler-1.16.1.gem (100%)

Successfully installed bundler-1.16.1

Parsing documentation for bundler-1.16.1

Installing ri documentation for bundler-1.16.1

Done installing documentation for bundler after 6 seconds

1 gem installed

 

C:\Sites>

执行:

bundle install --without development test

执行需要一段时间

提示

Fetching mysql2 0.4.10 (x86-mingw32)

Installing mysql2 0.4.10 (x86-mingw32)

 

执行:

bundle install --without development test rmagick 

这里可能有问题,这个问题是可以忽略的

执行:

bundle exec rake generate_secret_token

[

<<<<<<<<<<<  这一步也会出现问题

出错:Failed to load libmysql.dll from

Failed to load libmysql.dll from C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\mysql2-.4.10-x86-mingw32\vendor\libmysql.dll

问题的解决方法:

卸载

gem uninstall mysql2

Successfully uninstalled mysql2-0.4.10-x86-mingw32

下载  Mysql 的客户端对应版本 zip 格式文件,解压缩到d:根目录下,执行

gem install mysql2 --platform=ruby -- '--with-mysql-lib="d:\mysql-connector-c-noinstall-6.0.2-win32\lib" --with-mysql-include="d:\mysql-connector-c-noinstall-6.0.2-win32\include"'

再执行一次:

bundle exec rake generate_secret_token

如果还是有问题,启用流氓方法,暴力解决,将高版本的 mysql 目录中的文件复制到低版本mysql2 (0.4.10 x86-mingw32)目录中(或直接修改目录名):

C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\mysql2-0.4.10-x86-mingw32

]

 

设置环境变量,启动起来它:

set RAILS_ENV=production

bundle exec rake db:migrate

set RAILS_ENV=production

set REDMINE_LANG=en

bundle exec rake redmine:load_default_data

 

8

启动服务测试(保证 MySQL 服务是启动状态)

bundle exec rails server webrick -e production

C:\Sites\redmine-3.2.9>bundle exec rails server webrick -e production

 

9

测试并使用 Redmine

http://localhost:3000/

http://127.0.0.1:3000

 

停止服务使用^C

 

10 

如果需要外网访问 配置外网的访问功能

rails s -b 0.0.0.0

或者执行

bundle exec rails server webrick -e production -b 0.0.0.0

外网访问地址:略。

 

11 

外网访问没有SSL不安全。试用一个https简单方案。

安装openssl

D:\openssl-0.9.8h-1-bin

  

12

 openssl 使用记录 

D:\openssl-0.9.8h-1-bin\bin>openssl req -x509 -sha256 -nodes -days 1095 -newkey rsa:2048 -keyout self.key -out self.crt -subj /CN=*.com -config openss

l.cnf

Loading 'screen' into random state - done

Generating a 2048 bit RSA private key

........+++

..............+++

writing new private key to 'self.key'

-----

 

D:\openssl-0.9.8h-1-bin\bin>dir

 D:\openssl-0.9.8h-1-bin\bin 的目录

2018/06/06  16:58             1,127 self.crt

2018/06/06  16:58             1,679 self.key

 

D:\openssl-0.9.8h-1-bin\bin>openssl pkcs12 -export -out self.pfx -inkey self.key -in self.crt

Loading 'screen' into random state - done

Enter Export Password:

Verifying - Enter Export Password:

 

D:\openssl-0.9.8h-1-bin\bin>openssl x509 -inform pem -in self.crt -outform der -out self.cera

 

D:\openssl-0.9.8h-1-bin\bin>dir

2008/08/23  03:52           344,409 rsa_test.exe

2018/06/06  16:59               792 self.cera

2018/06/06  16:58             1,127 self.crt

2018/06/06  16:58             1,679 self.key

2018/06/06  16:59             2,397 self.pfx

 

 

13 

安装&配置反向代理。niginx安装。

nginx安装以后。修改配置参数文件。

 

nginx.conf文件修改如下:

 

#user  nobody;

worker_processes  1;

 

#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;

 

pid        logs/nginx.pid;

 

 

events {

    worker_connections  1024;

}

 

 

http {

    include       mime.types;

    default_type  application/octet-stream;

 

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

 

    access_log  logs/access.log  main;

 

    sendfile        on;

    #tcp_nopush     on;

 

    #keepalive_timeout  0;

    keepalive_timeout  65;

 

    #gzip  on;

 

    server {

        listen       80;

        server_name  localhost;

 

        #charset koi8-r;

 

        #access_log  logs/host.access.log  main;

 

        location / {

            root  C:\Perl\html;

            index  index.html index.htm;

        }

 

        error_page  404              /404.html;

 

        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

 

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80

        #

        #location ~ \.php$ {

        #    proxy_pass   http://127.0.0.1;

        #}

 

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        #

        #location ~ \.php$ {

        #    root           html;

        #    fastcgi_pass   127.0.0.1:9000;

        #    fastcgi_index  index.php;

        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

        #    include        fastcgi_params;

        #}

 

        # deny access to .htaccess files, if Apache's document root

        # concurs with nginx's one

        #

        #location ~ /\.ht {

        #    deny  all;

        #}

    }

 

 

    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;

 

    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}

 

 

    #HTTPS server

    

    server {

        listen       443 ssl;

        server_name  localhost;

        

        ssl                  on;

        ssl_certificate      self.crt;

        ssl_certificate_key  self.key;

 

    #    ssl_session_cache    shared:SSL:1m;

    #    ssl_session_timeout  5m;

 

    #    ssl_ciphers  HIGH:!aNULL:!MD5;

    #    ssl_prefer_server_ciphers  on;

 

        location / {

            proxy_pass  http://127.0.0.1:3000;

            root   html;

            index  index.html index.htm;

        }

    }

 

}

 

 14

https 代理测试:  https://127.0.0.1

注意:这时不安全的  http://localhost:3000/ 是依然可以访问的。 

 

posted on 2018-06-08 10:38  johnphan  阅读(1665)  评论(0编辑  收藏  举报

导航