メモブロ

IT技術のメモ

【第146回】日商簿記2級に受かったのでメモしておく

■勉強期間

1ヶ月(1日平均6時間)

 

テキスト

商業簿記:スッキリシリーズ(

以前買ったTACの簿記の教科書を持っていたが、

商業簿記に関しては試験範囲が改定されているので書い直し。

工業簿記:簿記の教科書、問題集

過去問題集(TAC)

 

■備考

あてるや網羅シリーズは一切手を付けず

過去問を繰り返しやりました。今回の試験は簡単だったみたいですね。

 

 

windwosからvirtualboxにインストールしたcentos7にssh接続まで

ssh接続はteratermを使用。

①設定-ネットワーク-アダプター2のネットアダプターを有効化にして

割当をホストオンリーアダプターにしてゲストOSの再起動

②ip addr でemp0s8のipaddressを調べる

teratermを起動し

ホストに上記②で調べたipアドレスを入力しゲストOSのユーザ、パスワード

を設定しssh接続

CentOS再起動後にApacheが起動できない時の対処法

まずhttpdのプロセスが残っているかの確認

 

[root@localhost ~]# lsof -i | grep http

httpd    1162 root    4u  IPv6   8530      0t0  TCP *:http (LISTEN)

httpd    1162 root    6u  IPv6   8534      0t0  TCP *:https (LISTEN)

 

残っていればプロセスをkill

[root@localhost ~]# kill -9 1162

 

httpd起動時にssl のパスワードを聞かれるのでssl設定時のパスワードを入力

[root@localhost ~]# /etc/init.d/httpd start

httpd を起動中: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

Apache/2.2.15 mod_ssl/2.2.15 (Pass Phrase Dialog)

Some of your private key files are encrypted for security reasons.

In order to read them you have to provide the pass phrases.

 

Server localhost.localdomain:443 (RSA)

Enter pass phrase:openssl

 

これでhttpdの起動となった

 

apacheにOpenSSL設定

なければ↓
# yum install openssl # yum install mod_ssl

[root@localhost ~]# openssl version

OpenSSL 1.0.1e-fips 11 Feb 2013

 

[root@localhost ~]# cd /etc/httpd/conf

[root@localhost conf]# ls

extra  httpd.conf  httpd.conf.back20160811  magic

[root@localhost conf]# openssl genrsa -aes128 1024 > server.key

Generating RSA private key, 1024 bit long modulus

.............................................................................++++++

..........................++++++

e is 65537 (0x10001)

Enter pass phrase:openssl

Verifying - Enter pass phrase:openssl

 

[root@localhost conf]# openssl req -new -key server.key > server.csr

Enter pass phrase for server.key:

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [XX]:JP

State or Province Name (full name) :TOKYO

Locality Name (eg, city) [Default City]:Shinagawa

Organization Name (eg, company) [Default Company Ltd]:

Organizational Unit Name (eg, section) :

Common Name (eg, your name or your server's hostname) :192.168.56.101

Email Address :

 

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password :

An optional company name :

 

[root@localhost conf]# openssl x509 -in server.csr -days 36500 -req -signkey server.key > server.crt

Signature ok

subject=/C=JP/ST=TOKYO/L=Shinagawa/O=Default Company Ltd/CN=192.168.56.101

Getting Private key

Enter pass phrase for server.key:openssl

青字を追加

# vi /etc/httpd/conf.d/ssl.conf

  :
<VirtualHost _default_:443>
  ErrorLog logs/ssl_error_log
  TransferLog logs/ssl_access_log
  LogLevel warn
  SSLEngine on
  SSLProtocol all -SSLv2
  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
  SSLCertificateFile /etc/httpd/conf/server.crt
  SSLCertificateKeyFile /etc/httpd/conf/server.key
  <Files ~ "\.(cgi|shtml|phtml|php3?)$">
    :
  </Files>
</VirtualHost>
# /etc/init.d/httpd start

https接続するも、つながらず

 

iptablesssl用ポートの開放

-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

 

再起動

[root@localhost sysconfig]# /etc/init.d/iptables restart

 

これでhttps接続可能に

Apache Tomcat連携

apache経由でtomcatに接続するための設定

[root@localhost conf]# vi /etc/httpd/conf/httpd.conf

以下のコメントアウト(コメントになってれば)を外す

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

 

[root@localhost conf]# pwd

/etc/httpd/conf

[root@localhost conf]# mkdir /etc/httpd/confextra

[root@localhost conf]# vi extra/httpd-proxy.conf

 

[root@localhost extra]# vi /etc/httpd/conf/httpd.conf

最終行に追加

Include /etc/httpd/conf/extra/httpd-proxy.conf

 

[root@localhost extra]# vi /etc/httpd/conf/extra/httpd-proxy.conf

追加

ProxyPass /examples/ ajp://localhost:8009/examples/
 
tomcat,apache 再起動

[root@localhost webapps]# /etc/init.d/tomcat8 stop

[root@localhost webapps]# /etc/init.d/tomcat8 start

[root@localhost webapps]# /etc/init.d/httpd restart

 
これでapache経由で8080なしでtomcatへの接続ができる
 
しかしこのままでは8080経由でtomcatへのアクセスができてしまうので

[root@localhost webapps]# vi /opt/tomcat8/conf/server.xml

 ポート番号8080のConnector部分を以下のようにコメントアウト

<!--

<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

-->

 

もしくはアクセスをローカルホストから限定に

<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" address="127.0.0.1" />

 

 

これで8080でのアクセス不可に