Opensourcetechブログ

OpensourcetechによるNGINX/Kubernetes/Zabbix/Neo4j/Linuxなどオープンソース技術に関するブログです。

nginx unit 1.8.0で複数言語のアプリケーションプロセスを動かす!

こんにちは、LinuCエバンジェリストこと、鯨井貴博@opensourcetechです。

 igore sysoevさんと一緒

 

 nginx unit 1.8.0を使って、PHPとPerlをアプリケーションサーバとして使う設定の紹介です。

 

 以下にある「config_php_perl.json」をcurlで投入すればOKです!

https://github.com/kujiraitakahiro/nginx_unit/blob/master/config_php_perl.json

とりあえず、普通に使ってみます。

[root@localhost tmp]# curl -X PUT -d @/var/tmp/config_php_perl.json --unix-socket /var/run/unit/control.sock http://localhost/config/
{
"success": "Reconfiguration done."
}
[root@localhost tmp]# curl --unix-socket /var/run/unit/control.sock http://localhost/config
{
"listeners": {
"*:8888": {
"pass": "applications/blogs-php"
},

"*:8887": {
"pass": "applications/blogs-perl"
}
},

"applications": {
"blogs-php": {
"type": "php",
"processes": 5,
"root": "/www/blogs/scripts",
"index": "index.php"
},

"blogs-perl": {
"type": "perl",
"processes": {
"max": 10,
"spare": 5,
"idle_timeout": 20
},

"working_directory": "/www/store/",
"script": "index.pl"
}
}
}

 

8888/tcpと8887/tcpが解放されてますね。

※CentOS6などをお使いの方は、ssではなくnetstatなどを使ってくださいね。

[root@localhost tmp]# ss -tan
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 128 *:8887 *:*
LISTEN 0 128 *:8888 *:*
LISTEN 0 100 127.0.0.1:25 *:*
ESTAB 0 36 192.168.11.4:22 192.168.11.2:53791
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*

 

 

 

 

 

www.slideshare.net

github.com

www.facebook.com

twitter.com

www.instagram.com

 

 

にほんブログ村 IT技術ブログ Linuxへ
Linux

にほんブログ村 IT技術ブログ オープンソースへ
オープンソース

 

 

Opensourcetech by Takahiro Kujirai