2
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?

More than 5 years have passed since last update.

Mautic AMIでバーチャルホストを追加する

Posted at

Mautic Powered by AMIAGE on AWS Marketplace

そもそもMauticでバーチャルホストをガンガン追加する必要があるのかという疑問には答えない。

ファイルのコピー

$ sudo su -

# ファイルコピー
# mkdir /var/www/vhosts
# cp -R /var/www/html/ /var/www/vhosts/YOUR.DOMAIN


# コピー元の設定情報削除
# rm -f app/config/local.php
# rm -f app/bundles/InstallBundle/InstallFixtures/ORM/LoadUserData.php

# オブジェクトキャッシュ削除
# rm -rf app/cache/prod/*

Apache設定

# vim /etc/httpd/conf.d/YOUR.DOMAIN.conf
<VirtualHost *:443>
DocumentRoot /var/www/vhosts/YOUR.DOMAIN/
ServerName YOUR.DOMAIN
CustomLog logs/YOUR.DOMAIN.log combined

include conf.d/ssl.include

<Directory "/var/www/vhosts/YOUR.DOMAIN/">
  include conf.d/mautic.include
</Directory>

include conf.d/letsenc.include
</VirtualHost>

# vim conf.d/mautic.include
Require all granted
AllowOverride All
Order allow,deny
Allow from all

SSLを設定

# /opt/letsencrypt/bin/letsencrypt certonly -t \
  -d YOUR.DOMAIN \
  -a webroot --webroot-path=/var/www/vhosts/YOUR.DOMAIN --rsa-key-size 2048 --server https://acme-v01.api.letsencrypt.org/directory
  
# crontab -e
0 4 1 * * root /opt/letsencrypt/bin/letsencrypt renew`

ここまでやってYOUR.DOMAINにアクセスすると、Mauticのセットアップウィザードが起動する。

cronjobの設定

# crontab -u apache -e
# Updating Lead Lists
1-59/5 * * * * /usr/bin/php /var/www/vhosts/hogehoge.com/app/console mautic:campaigns:trigger

# Update Campaigns
1-59/5 * * * * /usr/bin/php /var/www/vhosts/hogehoge.com/app/console mautic:campaigns:update

# Execute Campaign Actions
1-59/5 * * * * /usr/bin/php /var/www/vhosts/hogehoge.com/app/console mautic:leadlists:update

付記:Apacheの設定ファイルをまとめて作るスクリプトなど

# cd /etc/httpd/conf.d/
# vim vhost.template 
<VirtualHost *:443>
DocumentRoot /var/www/vhosts/_HOSTNAME_/
ServerName _HOSTNAME_
CustomLog logs/_HOSTNAME_.log combined

include conf.d/ssl.include

<Directory "/var/www/vhosts/_HOSTNAME_/">
  include conf.d/mautic.include
</Directory>

include conf.d/letsenc.include
</VirtualHost>

# ls m0* -1 | sed s/\.conf// | xargs --replace bash -c "cat vhost.template | sed s/_HOSTNAME_/{}/ > {}.conf"
2
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
2
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?