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/ 是依然可以訪問的。 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM