Pages

2017年12月26日 星期二

Tomcat使用不同Port運行不同的webapps

<Service name="Catalina"> <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> ...

Tomcat Server.xml <Host>與<Context>差異

<!-- Host主要設定Domain Name的對應名稱與預設解WAR檔的目錄 --> <Host name="app.google.com" appBase="webapps" unpackWARs="true" xmlValidation="false" xmlNamespaceAware="false"> <!--Context 主要設定URL後面的路徑對應名稱 --> <Context docBase="/webap/documents/app1" path="/" reloadable="true" workDir="/webap/documents/work/api1"></Context> </Host> <Host name="api.google.com" appBase="webapps"unpackWARs="true" xmlValidation="false" xmlNamespaceAware="false"> ...

CentOS 6.x安裝PHP 5.5 與MySQL 5.5

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm yum --enablerepo=remi update -y # update php5 yum --enablerepo=remi,remi-php55 update -y yum clean all yum remove mysql* php* mysql-libs-5.1.73-5.el6_6.x86_64 yum remove php* yum --enablerepo=remi install mysql mysql-server mysql-connector-odbc mysql-devel...

【Shell】Mysql Dump多個MySQL資料庫

透過vi寫一個備份MySQL多個資料的 db_backup.sh db_backup.sh檔案內容: #!/bin/sh . ~/.bashrc for DB in db1 db2 db3 do DATE=`date +%Y-%m-%d` HOST="xxx.xxx.xxx.xxx" DEST=/db_backup/${HOST}_mysql_dump_${DB}_${DATE}.sql ### dump db mysqldump --user=<username>--password=<password> --host=${HOST} --databases ${DB} > $DEST ### compress dump files gzip $DEST done 設定該Shell可以運行 chmod 755 db_backup.sh ./db_backup.s...

CentOS 6.9安裝Python 2.7與Azure CLI

在Azure上的CentOS 6.9安裝Azure CLI方式如下: # 安裝Python 2.7 wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64//python27-libs-2.7.14-1.ius.centos6.x86_64.rpm rpm -Uvh python27-libs-2.7.14-1.ius.centos6.x86_64.rpm rm -rf python27-libs-2.7.14-1.ius.centos6.x86_64.rpm vim /etc/bashrc /etc/bashrc檔案內容新增 # 設定Python的Path路徑到bashrc的最後一行 export PATH=/opt/rh/python27/root/usr/bin/:$PATH source /etc/bashrc vim /etc/ld.so.conf # 檢查ld.so.conf內容設定 include...

CentOS 6.9上修改TimeZone方式

在Azure上的CentOS 6.9上修改TimeZone的方式如下: vim /etc/sysconfig/clock #下方為m原本的位置是在America,修改成您想要的位置。 Zone=“Asia/Shanghai” 接下來,透過以下Shell指令,我們可以將修改好的TimeZone設定生效。 cp /etc/localtime /root/old.timezone rm -rf /etc/localtime #要與TimeZone的位置一致 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #查看目前時間 dat...

2017年3月7日 星期二

Tomcat 9 多域名SSL設定

在Tomcat 9.0的環境下,可以支援多個域名的設定,首先要先在Connector上先設一個預設的域名與SSL的檔案設定後,再到SSLHostConfig標籤下添加其他域名。 註:JKS檔案可以經由KSE的軟體,將PFX的憑證檔案轉換成JSK的檔案。 <Connector port="8443" protocol="org.apache.coyote.http11.Http11Nio2Protocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" sslEnabledProtocols="TLSv1.2,TLSv1.1,TLSv1" URIEncoding="UTF-8" keystoreFile="conf/aaa.jks" keystorePass="changeit"...