0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ZabbixとWeTTYを共存させるためにnginxとapache2の設定した

0
Posted at

ZabbixのWEB UIとWeTTYを共存させるために、nginxとApache2の設定をした

ZabbixWeTTYってサービスのWEBフロントエンドを一つのサーバで共存させたかったので、nginxのconfファイルやApache2のconfファイル、WeTTYのsystemdファイル等を編集しました。

代替テキスト
まずnginxのconfでzabbixのWEBフロントエンドとwettyのポートへのリバースプロキシを設定
/etc/nginx/nginx.conf

/etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
        worker_connections 768;}
http{
  server {
    server_name         yourservername.com;
    listen                  80;

    location ^~ /wetty{
      proxy_pass http://127.0.0.1:3000/wetty;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_read_timeout 43200000;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
    }
    location ^~ /zabbix{
      proxy_pass http://127.0.0.1:8010/zabbix;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_read_timeout 43200000;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;

    }
  }
}

代替テキスト
次にZabbixのフロントエンドを届けてるApache2のポートを上で設定しているポート(8010)に変更
/etc/apache2/ports.conf

/etc/apache2/ports.conf
Listen 8010
<IfModule ssl_module>
  Listen 8010
</IfModule>
<IfModule mod_gnutls.c>
  Listen 8010
</IfModule>

WeTTYをsystemdのサービス化。ついでにポート番号も固める
/etc/systemd/system/wetty.service

/etc/systemd/system/wetty.service
[Unit]
Description=wetty service

[Service]
After=network.target
Type=simple
Restart=always
RestartSec=1
ExecStart=/usr/local/bin/wetty -p 3000

[Install]
WantedBy=multi-user.target

これ全部AWSの一つのEC2インスタンスでやってるんですよね・・・
せっかくAWS触るならもっとAWSらしい事やりたいものです。
ネタとか頂けたら幸いです。
取り敢えずLambda、DynamoDB、Amplifyとかはハンズオン動画に沿って触ってみました。
AWS 初心者向けハンズオン

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?