4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pleasanterのwebサーバにapache2を使う場合(ベースURL指定あり)のメモ

Last updated at Posted at 2025-03-30

目的と前提

ノーコードツールのPleasanterへのアクセスをapache2で設定するための自分用のメモです。
webサーバは、Pleasanter以外にも使っているので、最終的にはベースURLを指定してPleasanterを使うようにします。
ubuntu serverにPleasanterのインストールは終了している前提です。

Pleasanterについては、こちら↓↓

主な内容

  1. 足がかりになりそうな公式コンテンツ
  2. 共通事項
  3. ベースURLを指定しないパターン
  4. ベースURLを指定するパターン

足がかりになりそうな公式ドキュメント

chatGPTを使いながらいろいろやってみたが、よくよく調べたらそれなりの公式ドキュメントがあったので、こちらを見た方が良いかも…

ユーザマニュアル↓↓

apacheでのインストール↓↓

ベースURLの変更↓↓

共通事項

【必要なモジュールの有効化】

今回の設定で使うモジュールをあらかじめ有効化しておく

sudo a2enmod proxy proxy_http headers
sudo systemctl restart apache2

【設定ファイルの文法エラーチェック】

設定ファイルを有効化した後、うまくリロードできないときなどのチェック方法

sudo apache2ctl configtest

ベースURLを指定しないパターン

インストールに関する公式ドキュメントでは、nginxを使用する方法の記載があり、nginxの設定内容は次のとおり。

/etc/nginx/conf.d/pleasanter.conf
server {
    listen  80;
    server_name   192.168.1.100;
    client_max_body_size 100M;
    location / {
       proxy_pass         http://localhost:5000;
       proxy_http_version 1.1;
       proxy_set_header   Upgrade $http_upgrade;
       proxy_set_header   Connection keep-alive;
       proxy_set_header   Host $host;
       proxy_cache_bypass $http_upgrade;
       proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

これをapache用に書き換えると次のとおり。(ファイル名は任意)

/etc/apache2/sites-available/my_site.conf
<VirtualHost *:80>
    ServerName 192.168.1.100

    # クライアントの最大アップロードサイズ
    LimitRequestBody 104857600

    ProxyPreserveHost On
    ProxyPass / http://localhost:5000/
    ProxyPassReverse / http://localhost:5000/

    RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}

    <Proxy *>
        Require all granted
    </Proxy>
</VirtualHost>

設定の有効化

sudo a2ensite my_site
sudo systemctl reload apache2

ベースURLを指定するパターン

webサーバはほかにも使うので、http://www.domain.comでアクセスした際には、普通に/var/www/htmlに接続し、http://www.domain.com/pleasangerでアクセスした時にはPleasanterに接続する場合。

【Pleasanterの起動設定】

/etc/systemd/system/pleasanter.serviceに次のように内容追加
追加前

/etc/systemd/system/pleasanter.service
  [Service]
  ExecStart = /root/dotnet/dotnet Implem.Pleasanter.dll

追加後

/etc/systemd/system/pleasanter.service
  [Service]
  ExecStart = /root/dotnet/dotnet Implem.Pleasanter.dll --pathBase=/pleasanter

【パラメータファイルService.jsonの設定】

デフォルト設定でのインストールだと/web/pleasanter/Implem.Pleasanter/App_Data/Parametersあたりにファイルあり。
Service.jsonの「AbsoluteUri」を次のように設定(デフォルト設定はnull

Service.json
    "AbsoluteUri": "http://localhost/pleasanter"

【apacheの設定】

/etc/apache2/sites-available/my_site.conf
<VirtualHost *:80>
    ServerName 192.168.1.100

    # 通常のWebサイトのルートディレクトリ
    DocumentRoot /var/www/html

    <Directory /var/www/html>
        Require all granted
    </Directory>

    # /pleasanter のパスだけをリバースプロキシ
    ProxyPreserveHost On
    ProxyPass /pleasanter http://localhost:5000/pleasanter
    ProxyPassReverse /pleasanter http://localhost:5000/pleasanter

    <Location /pleasanter>
        Require all granted

        # X-Forwarded-For や X-Forwarded-Proto を追加
        RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
        RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
    </Location>
</VirtualHost>

【apacheとPleasanterの再起動】

sudo systemctl restart apache2
sudo systemctl restart pleasanter
4
1
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
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?