[CentOS 7.2] Orange 0.6.4 Installation and Configuration

———2017-08-25 Re-edit the format———
Orange is an easy-to-use open source API Gateway

1. Install dependencies

(1) Install OpenSSL (Openresty dependency library)

[root@local ~]# yum install openssl-devel

(2) Install PCRE (Openresty dependency library)

[root@local ~]# yum install pcre-devel

(3) Compile and install Openresty (Orange dependency)

< div>

[root@local ~]# wget https://openresty.org/download/openresty-1.11.2.3.tar .gz[root@local ~]# ./configure -j2 --with-http_stub_status_module

Compile and install

[root@local ~]# gmake[root@local ~]# gmake install

or

[root@local ~]# make[root@local ~]# make install

The default installation directory is

/usr/local/openresty

.bash_profile Configure environment variables:

PATH=$PATH:$HOME/bin:/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin

*Note:
After the author used the official yum installation source provided by Openresty to install, when checking the orange installation status, Nginx encountered the following error. The reason is unknown, so I chose to compile and install in the end. In addition, the use of yum installation only generates openresty executable files, but does not generate resty files, you need to create a soft connection “ln -s” by yourself.

[root@local ~]# orange helpnginx:invalid option: "/usr /local/bin/orange"

(4) Compile and install the lor framework (Orange dependency)

[root@local ~]# git clone https://github.com/sumory/lor.git[root@local ~]# cd lor[root@local ~]# make install

The default installation directory is : /Usr/local/lor
Executable file: /usr/local/bin/lord

Two, install Orange

[root@local ~]# git clone https://github.com/sumory/orange.git[root@local ~]# cd orange[root@local ~]# make install< /pre>Because Orange is free to install, you can also use start.sh to start it directly. Therefore, only the command line tools are actually installed. Check the command line tools as follows. 
[root@beijing5 openresty]# orange helpOrangev0.6.4, OpenResty/Nginx API Gateway.Usage:orange COMMAND [OPTIONS ]Thecommands are:stop Stop current Orangeversion Show the version of Orangerestart Restart Orangereload Reload the config of Orangestore Init/Update/Backup Orange storehelp Show help tipsstart Start the Orange Gateway

The default installation directory is: /usr/local/orange
Executable file: /usr/local/bin/orange

Three, configure Orange

Orange has two main configuration files orange.conf and nginx.conf, you can execute "make install" Before, first modify the two configuration files.

(1) Configuration file orange.conf

Mainly modify the configuration related to the database connection, and set the dashboard password to log in, the initial password admin/orange_admin.

{ "plugins":[ "stat", "monitor", "redirect ", "rewrite", "rate_limiting", "property_rate_limiting", "basic_auth", "key_auth", "signature_auth", "waf", "divide", "kvstore" ], "store":"mysql", "store_mysql" :{ "timeout":5000, "connect_config":{ "host": "192.168.1.107", "port": 3306, "database": "orange", "user": "orange_dba", "password": " orange_passwd", "max_packet_size": 1048576 }, "pool_config":{ "max_idle_timeout": 10000, "pool_size": 3 }, "desc":"mysql configuration" }, "dashboard":{ "auth":true, " session_secret":"y0ji4pdj61aaf3f11c2e65cd2263d3e7e5", "whitelist":[ "^/auth/login$", "^/error/$"] }, " api":{ "auth_enable":true, "credentials":[ {"username":"api_username", "password":"api_password"}] }}

( 2) The configuration file nginx.conf

can be started directly with the default configuration file, and then modified according to the actual business. It is recommended to set all error_log output levels to warn, as follows

error_log./logs/error.log warn;

Otherwise, a large number of log records will be output. In addition, it is recommended to set a crontab timer task to split the log by day.
In addition, it is recommended to split the default server configuration of nginx.conf and the newly added server configuration into several files, such as main.conf, dashboard.conf, default.upstream.conf, api.conf, and then in the main Imported in the configuration file, as follows

include/usr/local/orange/conf/conf.d/*.conf; 

[root@local ~]# yum install pcre-devel

[root@local ~]# wget https://openresty.org/download/openresty- 1.11.2.3.tar.gz[root@local ~]# ./configure -j2 --with-http_stub_status_module

Leave a Comment

Your email address will not be published.