end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

Teiid Designer は、Eclipse Marketplace からinstall OK

「Teiid」で検索すると、「Red Hat Developer Studio Integration」と表示され、「おや?」と思いますが、その内容を展開すると、「JBoss Data Virtualization Development (Teiid Designer)」が見つかります。

f:id:end0tknr:20181022093700p:plain

installが完了すると、eclipseのメニューバーのwindow → perspective → open perspective → other から Teiid を見つけることができます。

f:id:end0tknr:20181022212536p:plain

f:id:end0tknr:20181022212539p:plain

jboss ( wildfly ) とsampleアプリのdeploy

javaのアプリサーバは、不慣れなので、練習。

jboss community editionの名称が、wildfly になっていることすら知りませんでした。

jboss ( wildfly ) のinstall

といっても、download して、解凍するだけ

$ wget http://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz
$ tar -xvf wildfly-14.0.1.Final.tar.gz

jboss ( wildfly ) の設定

設定fileの編集と、ユーザの追加を行います。

$ vi wildfly-14.0.1.Final/standalone/configuration/standalone.xml

old) <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
new) <inet-address value="${jboss.bind.address.management:192.168.244.101}"/>
old) <inet-address value="${jboss.bind.address:127.0.0.1}"/>
new) <inet-address value="${jboss.bind.address:192.168.244.101}"/>

jbossは、port=8080でサービス、port=9990で管理を行います。 私の環境では、vmにinstallしていることもあり、上記でipを 192.168.244.101 に変更しています。

wildfly-14.0.1.Final/standalone/configuration 以下には、 standalone-full-ha.xml や standalone-full.xml , standalone-ha.xml 等の 設定サンプルもあります。

https://access.redhat.com/documentation/ja-jp/red_hat_jboss_enterprise_application_platform/7.0/html-single/configuration_guide/index#standalone_server_configuration_files

jboss には、standalone の他に、domainもあるようですが、違いは理解していません。

次は、ユーザの追加です。

Management User と Application User の違いは理解していませんが、 「Management User」で追加しています。

$ wildfly-14.0.1.Final/bin/add-user.sh 

What type of user do you wish to add? 
 a) Management User (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : end0tknr
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
   :
<以降、略> 

sampleアプリのbuildの前に、maven の install

[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
To build this project Maven 3.2.5 (or greater) is required. Please install it.

古いmavenでbuildすると、上記のようなerrorとなるので、mavenからinstallします。

$ cd ~/local/
$ wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
$ tar -xvf ~/tmp/apache-maven-3.5.4-bin.tar.gz 
$ ln -s apache-maven-3.5.4 maven

sampleアプリのbuild

$ ~/tmp/
$ git clone https://github.com/jboss-developer/jboss-eap-quickstarts.git
$ cd jboss-eap-quickstarts/helloworld
$ ~/local/maven/bin/mvn clean install

上記を実行すると、jboss-eap-quickstarts/helloworld/target/helloworld.war ができます。

「mvn clean install wildfly:deploy」と実行すると、wildfly へのデプロイまで 行ってくれるようですが、 先程、「jboss.bind.address.management:192.168.244.101」のように変更していることもあり、「wildfly:deploy」なしでbuildしています。

sampleアプリ (helloworld)のdeploy

後は、http://192.168.244.101:9990 から管理画面に入り、 先程の helloworld.war を uploadすれば、完了です。

emacs for win → spacemacs の移行とりやめ

自分用メモ

thinkpad x1 carbon (英語キーボード) + windows 10で、 emacs-24.5-IME-patched for win を使用していますが、 google日本語入力の変換候補のwindowsが表示されません。

そこで、試しに spacemacs をinstallしてみました。 spacemacsは、確かに多機能ですが、先程のgoogle日本語入力問題は解消されない為、 移行とりやめにしました。

http://spacemacs.org/

Log::Log4perl におけるバッファリング防止は、log4perl.appender.Logfile.autoflush=1

メモ

use strict;
use warnings;
use Date::Calc;
use Log::Log4perl;
   

my $CONF =
    {log=>
     {
#      'log4perl.rootLogger'=> 'INFO, LOGFILE',
      'log4perl.rootLogger'=> 'DEBUG, LOGFILE, CONSOLE',
      'log4perl.appender.LOGFILE'=>'Log::Log4perl::Appender::File',
      #↓ココ。「1」でバッファリング防止
      'log4perl.appender.Logfile.autoflush' => 1,
      'log4perl.appender.LOGFILE.dir'=> $APP_ROOT,
      'log4perl.appender.LOGFILE.filename'=> $APP_ROOT. 'migrate.log',
      'log4perl.appender.LOGFILE.mode'=>'append',
      'log4perl.appender.LOGFILE.layout'=>'Log::Log4perl::Layout::PatternLayout',
      'log4perl.appender.LOGFILE.layout.ConversionPattern'=>'%d [%p] %m %n',

      'log4perl.appender.CONSOLE'=> 'Log::Log4perl::Appender::Screen',
      'log4perl.appender.CONSOLE.layout' => 'Log::Log4perl::Layout::PatternLayout',
      'log4perl.appender.CONSOLE.layout.ConversionPattern' => '%d [%p] %m %n'},
    };
my $LOGGER;


sub do_main {
    my ($self ) = @_;
    $LOGGER = init_logger();

    $LOGGER->error($tmp_msg);
}

sub init_logger {

    Log::Log4perl::init($CONF->{log});
    my $logger = Log::Log4perl::get_logger("rootLogger");
    unless($logger){
        die "fail init_logger() $!";
    }
    return $logger;
}

コーチング手法。超・抜粋

コーチング ≠ ティーチング

コミュニケーションの方向
ティーチング 一方向。教え込む、指示
コーチン 双方向。働きかけ、提案、引き出す

委任 ≠ 放任

責任は、委任した側(上司)にある

コーチングにおける3つのマインド

内容
Interactive 双方向コミュニケーション
on going 継続的コミュニケーション
tailor made 相手に合わせたコミュニケーション

オープン/クローズ x 事実/意見 の質問順序

クローズ オープン
事実 1番目 2番目
意見 3番目 4番目
  • クローズ質問:Yes/Noで答えられる質問
  • オープン質問:Why/What/Howでの質問

その他、聞く側に回る。(聞く:話す=5:5 では話しすぎ)

質問 / 詰問

  • 質問:事に着目。例:できなかった原因は何だろう?
  • 詰問:人に着目。例:どうして、君はできなかったんだ?

DiSC理論と、接し方

長所 短所
D(主導) 行動力が高い。
意思決定が速い。
人に対しはっきり言う
ルールやチームワークに関心なし
i(感化) 人と接する事が好き。
ムードメーカ。楽観的。
緻密さに欠け、成果や人に対して厳しさに欠ける
S(安定) 協調性があり、人に対し協力的。 今の環境を好み変化を嫌う。
自ら考え行動する事が苦手。
C(慎重) 論理的、整合性を重視。
物事に対し細部まで納得しないと行動しない。
自分の考え、アイディアを批判されると防御的になる。

apache 2.4で ある拡張子のファイルをダウンロードさせる

とある拡張子を持つファイル(例: .xyz)をブラウザで開くと、 google chromeではファイルダウンロードしてくれますが、 ie11では、ブラウザで開いてしまう現象が発生。

そこで、httpd.confに

AddType application/octet-stream .xyz

を追加し、解消したかと思ったら、 同じ拡張子で、ファイルダウンロードとなる場合とブラウザで開いてしまう場合が発生。

なので、

<FilesMatch "\.(xyz)$">
    Header set Content-Disposition attachment
</FilesMatch>

を更に追加することで、解消。

CGI::Cookie で複数のcookieをsetするには、list リファレンスを使用

CGI::Cookie - Interface to HTTP Cookies - metacpan.org

以下の通り

1個の場合

#!/usr/local/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Cookie;

main();

sub main {
    my $cgi = CGI->new();

    my $cookie_1 = CGI::Cookie->new(-name    =>  'key_1',
                                    -value   =>  'val_1',
                                    -httponly=>  0);
    print CGI::header(-type=>'text/html',-charset=>'UTF-8',
                      -cookie=>$cookie_1);
    :
}

複数個の場合

#!/usr/local/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Cookie;

main();

sub main {
    my $cgi = CGI->new();

    my $cookie_1 = CGI::Cookie->new(-name    =>  'key_1',
                                    -value   =>  'val_1',
                                    -httponly=>  0);
    my $cookie_2 = CGI::Cookie->new(-name    =>  'key_2',
                                    -value   =>  'val_2',
                                    -httponly=>  1);

    
    print CGI::header(-type=>'text/html',-charset=>'UTF-8',
                      -cookie=>[$cookie_1,$cookie_2]);
    :
}

javascript? http cookie の httponly 属性を考える → 必要なcookieにのみ付けるべき

以前は、cookieのhttponly 属性に対し、うるさく言われることはありませんでしたが、 最近は、cookieのhttponly 属性を使用していない場合、セキュリティリスクの一つとして、 指摘されます。

ただ、httponly 属性のあるcookieは、javascriptから参照できなくなる為、非常に不便。

なので、必要なcookieにのみ付けるように。

以下、試した perl cgi script。

httponlyの有無により、javascriptからの参照可否を確認できます

#!/usr/local/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Cookie;
use Data::Dumper;

main();

sub main {
    my $cgi = CGI->new();

    my $cookie_1 = CGI::Cookie->new(-name    =>  'key_1',
                                    -value   =>  'val_1',
                                    -httponly=>  0);
    my $cookie_2 = CGI::Cookie->new(-name    =>  'key_2',
                                    -value   =>  'val_2',
                                    -httponly=>  1);

    
    print CGI::header(-type=>'text/html',-charset=>'UTF-8',
                      -cookie=>[$cookie_1,$cookie_2]);
    print html_src();
}


sub html_src {

    my $html_src =<<EOF;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<script>
function get_cookie(){
  alert( 'cookie_1=' + \$.cookie('key_1') );
  alert( 'cookie_2=' + \$.cookie('key_2') );
}
</script>
</head>
<body>
<button type="button" onClick="get_cookie();">GET COOKIE</button>
</body>
</html>
EOF
}

ざっくり知的財産権 (特許権と著作権)

次のurlにある書籍をナナメ読み

Amazon CAPTCHA

知的財産権の体系

# 備考
1.1 工業所有権 特許権 技術的思考
1.2 実用新案権 技術的思考
1.3 意匠権 工業デザイン
1.4 商標権 企業ブランド
2 営業秘密 - 技術情報,顧客情報など
3 著作権 - 思想,感情の表現物

特許権著作権の違い

そもそも、特許権の保護対象は「発明」。 ここで言う「発明」とは技術的思想の発想のうち「高度」なもの(特許法2条1項)。

システム開発において、 著作権の保護対象は「ソースコード」、特許権の保護対象は「アルゴリズム」となる (著作権法10条9号)。

例えば、ソースコードをそのままのコピーすること(デッドコピー)は 著作権が禁止し、

プログラムを逆コンパイルし、アルゴリズムを真似することは、 特許権が禁止する。

知財紛争事例 - 積算くん事件 - 画面デザインの模倣

詳細はインターネットを「積算くん事件」で検索すると早いと思います。

システムの画面デザインの模倣を訴えた訴訟でしたが、 そもそも「積算くん」の画面デザインは、ありふれたもので、 創作性がなかった為、「積算くん」側の訴えは棄却されたらしい

まぁ、システム開発自体、まだまだ新しいものですので、 知財紛争においても、「これ!!」という判断基準がないはず。 他の事例も集めないといけませんね

システムの開発委託や運用委託のRPF , SLA のサンプル

ITコーディネータ協会で公開されているサンプル(pdf等)が、これまで見てきた中では、最も具体的な印象です。

https://www.itc.or.jp/foritc/useful/rfpsla/

以下、その他 参考

経産省が公開する情報システムのモデル取引・契約書

http://www.meti.go.jp/policy/it_policy/softseibi/index.html#p02_01

厚生労働省の調達仕様書案

https://www.mhlw.go.jp/sinsei/chotatu/chotatu/shiyousho-an.html

perl DBD::Oracle for centos 7.4 によるoracle dbへの接続 - 2018年版

2013年に同様のエントリを記載していますが、 先日、試したところ、手こずったので、2018年版メモ。

https://end0tknr.hateblo.jp/entry/20131122/1385095932

oracleクライアントツール群のinstall

http://www.oracle.com/technetwork/jp/topics/linuxsoft-083388-ja.html

↑こちらからダウンロードし、rpmでinstall. この部分は、ほぼ前回同様。違う点といえば、clientのversion程度.(12.1->12.2)

$ sudo rpm -ivh oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
$ sudo rpm -ivh oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
$ sudo rpm -ivh oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm

oracleクライアントツール用の環境変数設定

この部分も、ほぼ前回同様。違う点といえば、clientのversionと、64bitによるpath.

ちなみに sqlplus のコマンド名も64bitで、 sqlplus64 になっていました。

$ sudo vi /etc/profile.d/oracle.sh
export ORACLE_HOME='/usr/lib/oracle/12.2/client64'
export C_INCLUDE_PATH='/usr/include/oracle/12.2/client64'
export LD_LIBRARY_PATH='/usr/lib/oracle/12.2/client64/lib'

DBD::Oracle のinstall

いつものように、「perl Makefile.PL」すると、以下のようにエラー

$ curl -LO https://cpan.metacpan.org/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
$ tar -xvf DBD-Oracle-1.74.tar.gz
$ cd DBD-Oracle-1.74
$ perl Makefile.PL 
Using DBI 1.641 (for perl 5.026002 on x86_64-linux-thread-multi) installed in /usr/local/lib/perl5/site_perl/5.26.2/x86_64-linux-thread-multi/auto/DBI/

Configuring DBD::Oracle for perl 5.026002 on linux (x86_64-linux-thread-multi)

Remember to actually *READ* the README file! Especially if you have any problems.

Installing on a linux, Ver#3.10
Using Oracle in /usr/lib/oracle/12.2/client64
DEFINE _SQLPLUS_RELEASE = "1202000100" (CHAR)
Oracle version 12.2.0.1 (12.2)

    Unable to locate an oracle.mk or other suitable *.mk
    file in your Oracle installation.  (I looked in
    /usr/lib/oracle/12.2/client64/rdbms/demo/demo_xe.mk /usr/lib/oracle/12.2/client64/rdbms/lib/oracle.mk /usr/lib/oracle/12.2/client64/rdbms/demo/oracle.mk /usr/lib/oracle/12.2/client64/rdbms/demo/demo_rdbms.mk /usr/lib/oracle/12.2/client64/rdbms/demo/demo_rdbms64.mk /usr/lib/oracle/12.2/client64/rdbms/lib/ins_rdbms.mk /usr/share/oracle/12.2/client64/demo.mk under /usr/lib/oracle/12.2/client64)

    The oracle.mk (or demo_rdbms.mk) file is part of the Oracle
    RDBMS product.  You need to build DBD::Oracle on a
    system which has one of these Oracle components installed.
    (Other *.mk files such as the env_*.mk files will not work.)
    Alternatively you can use Oracle Instant Client.

    In the unlikely event that a suitable *.mk file is installed
    somewhere non-standard you can specify where it is using the -m option:
        perl Makefile.PL -m /path/to/your.mk

    See the appropriate README file for your OS for more information and some alternatives.

なので、「-m /usr/share/oracle/12.2/client64/demo/demo.mk」オプションを追加し、 再度「perl Makefile.PL」を実行。

※ /usr/share/oracle/12.2/client64/demo/demo.mk は、先程のrpmでinstallされます

$ perl Makefile.PL -m /usr/share/oracle/12.2/client64/demo/demo.mk
$ make
$ make test
$ sudo make install

perlによるサンプルコード

前回2013年の接続方法では、接続できなかった為、connect()で与える引数を "(DESCRIPTION=(ADDRESS_LIST=..."に変更しました。

#!/usr/local/bin/perl
use strict;
use utf8;
use DBI;        #DBD::Oracle
use DBD::Oracle qw(:ora_types);
use Data::Dumper;

my $DBH;
my $DB_CONF =>
    {id_pw =>'user_id/user_pw',
     oracle=>
     join('',
          '(DESCRIPTION=',
          '(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.61.52.???)(PORT=1521)))',
          '(CONNECT_DATA=(SERVICE_NAME=???.sexy.co.jp)(SERVER=DEDICATED)))'),
    };

# $ENV{'ORACLE_HOME'} =   '/usr/lib/oracle/12.2/client64';
# $ENV{'LD_LIBRARY_PATH'}='/usr/include/oracle/12.2/client64';
# $ENV{'C_INCLUDE_PATH'}= '/usr/lib/oracle/12.2/client64/lib';
# $ENV{'nls_lang'}="JA16SJISTILDE";
# $ENV{'nls_lang'}="JA16SJIS";
# $ENV{'nls_lang'}="JAPANESE_JAPAN.UTF8"

main();

sub main {
    $DBH = connect_db();
    chk_sql_1();
    $DBH->disconnect();
}

sub chk_sql_1 {
    my $sql =<<EOF;
select * from XXXXXX_y where C_XXXXXX=?
EOF
    my $sth = $DBH->prepare($sql);
    $sth->execute('XXXXXX');
    while( my $row = $sth->fetchrow_hashref){
        print STDERR Dumper($row);
    }
}

sub connect_db {
    my $dbh = DBI->connect('dbi:Oracle:',
                           $DB_CONF->{id_pw}.'@'.$DB_CONF->{oracle},
                           '');
    return $dbh;
}

systemd による mysql自動起動は、まず、cmake時に「-DWITH_SYSTEMD=ON」オプション

https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html

上記に記載されている通り、cmake時に「-DWITH_SYSTEMD=ON」オプションを追加すると scripts/mysqld.service が作成されます。

※ systemdによる自動起動方法は、次のurlをご覧下さい. https://end0tknr.hateblo.jp/entry/20180722/1532220271

※ initdによる自動起動scriptは、これまで同様、support-files/mysql.server にあります

$ cd mysql-5.7.22
$ cmake . \
   -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
   -DDEFAULT_CHARSET=utf8 \
   -DDEFAULT_COLLATION=utf8_general_ci \
   -DENABLED_LOCAL_INFILE=true \
   -DWITH_INNOBASE_STORAGE_ENGINE=1 \
   -DWITH_EXTRA_CHARSETS=all \
   -DWITH_READLINE=ON \
   -DDOWNLOAD_BOOST=ON \
   -DWITH_BOOST=/home/end0tknr/tmp/boost \
   -DWITH_SYSTEMD=ON
$ make

$ cat scripts/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql
Type=forking
PIDFile=/var/run/mysqld/mysqld.pid

# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0
# Execute pre and post scripts as root
PermissionsStartOnly=true
# Needed to create system tables
ExecStartPre=/usr/local/mysql/bin/mysqld_pre_systemd
# Start main service
ExecStart=/usr/local/mysql/bin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS
# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql
# Sets open_files_limit
LimitNOFILE = 5000
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false

re: IPA 超上流から攻めるIT化の事例集で公開されている成果物サンプル集

種類としては豊富ですが、もう少し詳細な資料である方が、手を動かし安い気がします。 (えらそーに言ってますけど)

https://www.ipa.go.jp/sec/softwareengineering/tool/ep/index.html

https://www.ipa.go.jp/sec/softwareengineering/tool/ep/ep1.html

https://www.ipa.go.jp/sec/softwareengineering/tool/ep/ep2.html

https://www.ipa.go.jp/sec/softwareengineering/tool/ep/ep3.html

init → systemd 移行メモと、apache httpd と nginx の設定例

linux自動起動において、init → systemd 移行は避け気味で過ごしていましたが、 amazon linux2が発表され、systemd による自動起動が殆どなるので、メモ。

サービス一覧の確認

init.d systemd
chkconfig --list systemctl list-units --type=service または
systemctl list-unit-files --type=service --no-pager

以下、実行例。まずは、init.d の場合

$ /sbin/chkconfig --list
mysql.server    0:off   1:off   2:on    3:on    4:on    5:on    6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off

次にsystemd.

※「SUB=exited」 は必要な処理が完了したものを表します.

※「--type=service」はservice以外に mount,automount,socket,path,device,target がありますが、 自動起動(daemon化)では気にする必要はないかと思います.

$ /usr/bin/systemctl list-units --type=service
  UNIT                       LOAD   ACTIVE SUB     DESCRIPTION
  auditd.service             loaded active running Security Auditing Service
  crond.service              loaded active running Command Scheduler
  dbus.service               loaded active running D-Bus System Message Bus
  getty@tty1.service         loaded active running Getty on tty1
  kmod-static-nodes.service  loaded active exited  Create list of required static device no
* lvm2-monitor.service       loaded failed failed  Monitoring of LVM2 mirrors, snapshots et
* lvm2-pvscan@8:2.service    loaded failed failed  LVM2 PV scan on device 8:2
  mysql.server.service       loaded active running LSB: start and stop MySQL
* network.service            loaded failed failed  LSB: Bring up/down networking
      :                    

サービスの自動起動:登録や起動,終了,状態確認

以下の通り.

- init.d systemd
自動起動:登録 chkconfig --add sshd systemctl enable sshd
自動起動:削除 chkconfig --del sshd systemctl disable sshd
起動 service sshd start systemctl start sshd
停止 service sshd stop systemctl stop sshd
再起動 service sshd restart systemctl restart sshd
状態確認 なし? ps -efで確認? systemctl status sshd

apache httpd 2.4 の登録例

参考url

https://qiita.com/pb_tmz08/items/68a58979ca22748e8502 https://exfield.jp/View/pid:589/

$ vi /home/end0tknr/local/apache24/conf/apache24.service
[Unit]
Description=The Apache2.4 HTTP Server
After=network.target

[Service]
Type=forking
ExecStart=/home/end0tknr/local/apache24/bin/apachectl start
ExecReload=/home/end0tknr/local/apache24/bin/apachectl restart
ExecStop=/home/end0tknr/local/apache24/bin/apachectl stop

User=root
Group=root

# KillMode=???
# PIDFile=???
# EnvironmentFile=/usr/local/etc/apache/env.sh (ExecStartでのみ有効?)
# Environment=    ## 個別に定義する場合

[Install]
WantedBy=multi-user.target  # = run level

# 以下で /etc/systemd/system/ 以下に ln -s されます 
$ sudo systemctl enable /home/end0tknr/local/apache24/conf/apache24.service
$ sudo systemctl start apache24.service
$ sudo systemctl status apache24.service
$ sudo systemctl stop apache24.service

nginx の登録例

本家 www.nginx.com で紹介されていますので、以下をご覧下さい

https://www.nginx.com/resources/wiki/start/topics/examples/systemd/