2019/03/13

NGINX SSL/設定檔案



#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    gzip on;
    gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/json text/xml application/xml+rss image/jpeg image/gif image/png;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_comp_level 9;
    gzip_min_length 10k; # 大於這個 size 才壓縮,也可以寫 1000
    gzip_buffers 4 32k;
    gzip_vary on;

    #server {
    #    listen       80;
    #    server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
    #    error_page   500 502 503 504  /50x.html;
    #    location = /50x.html {
    #        root   html;
    #    }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    #}


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name mysite.idv.tw;
        return 301 https://$server_name$request_uri;
    }

    server {
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;

        ssl_certificate /etc/nginx/ssl/demo/mysite.idv.tw.bundle.crt;
        ssl_certificate_key /etc/nginx/ssl/demo/mysite.idv.tw.key;
        #ssl_dhparam /etc/nginx/ssl/demo/dhparams.pem;

        ssl_session_cache shared:SSL:9m;
        ssl_session_cache shared:ssl_session_cache:10m;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
        ssl_stapling on;
        ssl_stapling_verify on;
        add_header X-Frame-Options "DENY";
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
        resolver 8.8.8.8 8.8.4.4 valid=300s;
        resolver_timeout 5s;

        location ~ /\.ht {
            deny all;
        }
    }
}

2018/07/31

HTTP Server、SSL 操作與設定



Part 1: 自建 private key, 建立 CSR 申請第三方憑證
#private key, need password(keep it)
openssl genrsa -des3 -out private.key 2048

# certificate signing request (CSR)
openssl req -new -key private.key -out domaincsr.csr

#產生如下列問題:
Country Name (2 letter code) [XX]:TW => 填寫國名(兩碼),填完後按下enter
State or Province Name (full name) []:Taiwan =>填寫州或郡,填完後按下enter
Locality Name (eg, city) [Default City]:Taipei =>填寫城市名稱,填完後按下enter
Organization Name (eg, company) [Default Company Ltd]:MyCompany Inc =>填寫公司名稱,填完後按下enter
Organizational Unit Name (eg, section) []:IT Dept =>填寫部門名稱,填完後按下enter
Common Name (eg, your name or your server's hostname) []:www.mydomain.com =>填寫保護網域名稱,填完後按下enter
Email Address []: demo@mydomain.com=>填寫電子郵件地址(可不填),填完後按下enter
Please enter the following 'extra' attributes to be sent with your certificate request
A challenge password []: =>請留空白,按下enter
An optional company name []: =>填寫公司名稱(可不填),填完後按下enter

#利用 domaincsr.csr 申請第三方憑證

refrence url:
1. https://blog.longwin.com.tw/2014/08/apache2-ssl-create-build-setup-2014/
2. https://slproweb.com/products/Win32OpenSSL.html
3. http://wiki.gandi.net/zh-tw/ssl/dcv


Part 2: 申請到憑證之後下載憑證串鏈
至少包含 2 張憑證,分別是
1. 中繼憑證 (第三方單位會提供 or 直接下載)
ex: GandiStandardSSLCA2.pem

2. 第三方單位發下來的憑證 (第三方單位會提供 or 直接下載)
ex: mydomain.crt

Part 3: 製作 HTTP Server 憑證串
#產製沒有加密過的 private key
openssl rsa -in private.key -out server_no_pwd.key

#產製包含 key 和 第三方憑證 PEM 檔案
cat server_no_pwd.key > server.key

cat GandiStandardSSLCA2.pem mydomain.crt > server.pem

Part 4: 確認共有三個檔案內容:
1. 自行產生的 private key: server.key
2. 串聯的憑證: server.pem
3. 第三方認證公司發行的憑證: mydomain.crt


於 Apache2 的設定範例

ServerAdmin admin@mydomain.com.tw
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLCertificateFile /var/www/html/gandi_key/server.pem
SSLCertificateKeyFile /var/www/html/gandi_key/server.key
SSLCertificateChainFile /var/www/html/gandi_key/mydomain.crt


SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown


於 Ngnix 的設定範例
# HTTPS server
server {
listen 443 ssl;
server_name mydomain.com.tw;
access_log C://data//BackendService//logs//access_log.log;

ssl_stapling on;
ssl_stapling_verify on;

ssl_certificate /ngnix/gandi_key/server.pem
ssl_certificate_key /ngnix/gandi_key/server.key

#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;

#ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_prefer_server_ciphers on;

ssl_trusted_certificate /ngnix/gandi_key/mydomain.crt

location / {
proxy_pass http://127.0.0.1:4001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

2014/08/26

Installing Tomcat 7 + Postgres 9.3 on Amazon Linux


-------------------------------------------------------------------------------------------------------
Tomcat Part
-------------------------------------------------------------------------------------------------------

#install tomcat7

sudo yum install tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps
       
 

#auto startup


sudo chkconfig tomcat7 on
       
 

#redirect port


sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

sudo /sbin/service iptables save
       
 

-------------------------------------------------------------------------------------------------------
Postgres Part
-------------------------------------------------------------------------------------------------------

Install from rpm/yum from postgres repo

In the files
/etc/yum.repos.d/amzn-main.repo
and
/etc/yum.repos.d/amzn-updates.repo add the following in the
block [amzn-main]:

///////////////////////////////////////
exclude=postgresql*
///////////////////////////////////////

Then, install the repo rpm and run yum
# Change to home directory to download the software


cd ~/
       
 
# Get the right postgresql package (Redhat 64 Bit)


wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
       
 
# Install the package


sudo rpm -ivh pgdg-redhat93-9.3-1.noarch.rpm
sudo yum install postgresql93 postgresql93-server postgresql93-devel
       
 
# Check that the service is installed


sudo service postgresql-9.3 status
       
 
# should return "is stopped"

# init the DB


sudo service postgresql-9.3 initdb
       
 
# Start the DB

sudo service postgresql-9.3 start
       
 
# connect


sudo su - postgres
psql
       
 
# auto startup


sudo chkconfig postgresql-9.3 on
       
 
source

2014/07/11

Automatically Retry Failed Jobs in Quartz


Source: Automatically Retry Failed Jobs in Quartz

Retrying continuously until success:
If you want to keep trying over and over again until the job succeeds, all you have to do is throw a JobExecutionException with a flag to tell the scheduler to fire it again when it fails. The following code shows how:


class MyJob implements Job {
 
  public MyJob() {
  }
 
  public void execute(JobExecutionContext context)
                  throws JobExecutionException {
    try{
        //do something
    }
    catch(Exception e){
 
        Thread.sleep(10000); //sleep for 10 secs
 
        JobExecutionException e2 = new JobExecutionException(e);
        //fire it again
        e2.refireImmediately();
        throw e2;
    }
  }
}
       
 

Retrying n times:
It gets a bit more complicated if you want to retry a certain number of times only. You have to use a StatefulJob and hold a retryCounter in its JobDataMap, which you increment if the job fails. If the counter exceeds the maximum number of retries, then you can disable the job if you wish.




class MyJob implements StatefulJob {
 
  public MyJob() {
  }
 
  public void execute(JobExecutionContext context)
                                 throws JobExecutionException {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    int count = dataMap.getIntValue("count");
 
    // allow 5 retries
    if(count >= 5){
        JobExecutionException e = new JobExecutionException("Retries exceeded");
        //unschedule it so that it doesn't run again
        e.setUnscheduleAllTriggers(true);
        throw e;
    }
 
    try{
        //do something
 
        //reset counter back to 0
        dataMap.putAsString("count", 0);
    }
    catch(Exception e){
        count++;
        dataMap.putAsString("count", count);
        JobExecutionException e2 = new JobExecutionException(e);
 
        Thread.sleep(10000); //sleep for 10 secs
 
        //fire it again
        e2.refireImmediately();
        throw e2;
    }
  }
}
       
 

2014/05/03

Admob廣告收入


Admob廣告收入構成
收入=廣告展示量/1,000 * 千次展示收入
千次展示收入=點擊率 * 廣告單價
廣告單價,台灣大概0.1 USD,各國不一定
假設一個月
廣告展示量=100,000 次
點擊率 = (0.1%) 0.001
廣告收入=100000/1000*0.001*0.1=0.01USD
但是其他報告是說,
行動裝置平均每次點擊約有0.01 USD,一般網頁平均每次點擊約有0.1 USD
這報告告訴大家,錢真的不好賺啊 QQ

2013/02/28

PostgreSQL Binary Install in Win7



  • download binary files: http://www.enterprisedb.com/products-services-training/pgbindownload
  • unzip to c:\pgsql
  • create a batch file: setevn.bat:
      set PGHOME=C:\pgsql
      set PATH=%PGHOME%\bin;%path%
      set PGHOST=localhost
      set PGLIB=%PGHOME%\lib
      set PGDATA=%PGHOME%\data
  • as a system administrator to run the "command prompt"
  • execute the following script:
  •           C:\>cd C:\pgsql
      C:\pgsql>setenv.bat
      C:\pgsql>initdb.exe -D %PGDATA% -E UTF8 --locale=C
      C:\pgsql>pg_ctl.exe register -D %PGDATA% -N "PostgreSQL 918"

2012/12/26

SQL Server Table Schema 查詢與欄位定序



/*資料表*/
Select * From SysObjects Where xType='U' Order By Name

/*欄位*/
Select * From SysObjects A Inner Join SysColumns B On A.ID=B.ID Where A.xType='U' Order By A.Name,ColID

/*讀取SQL 資料表欄位結構的SQL 語法*/
Select A.Name As TableName,B.ColOrder As ColOrder,B.Name As ColName,C.Name As ColType,B.Length As ColLen,B.XPrec As ColPrecision,B.XScale As ColScale
From (SysObjects A Inner Join SysColumns B On A.ID=B.ID) Inner Join SysTypes C On B.XType=C.XType
Where A.XType='u'
Order By A.Name,B.ColOrder

/*修改欄位定序*/
ALTER TABLE MyTable ALTER COLUMN CharCol
varchar(10) COLLATE Chinese_Taiwan_Stroke

2012/11/13

reverse proxy without apache http server



在 $tomcat_home\conf\server.xml 中修改以下內容

 

<host appbase="" name="localhost" p="">unpackWARs="true" autoDeploy="true"  
 xmlValidation="false" xmlNamespaceAware="false"&gt;  
 <valve classname="org.apache.catalina.valves.AccessLogValve" directory="logs" p="">prefix="appName_access_log." suffix=".txt"  
 pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/&gt;  
 <context docbase="webapps/appName" path="" reloadable="false"></context>  
 </valve>
</host>  

2012/11/12

Amazon EC2 Running Tomcat on port 80

SSH command:

#sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

#sudo /sbin/service iptables save

server.xml:


#service tomcat7 restart

2012/10/18

SSH in CentOS 6.3



SSH 安裝
#sudo yum  install openssh-server openssh-clients

SSH 開機時啟動
#sudo /sbin/chkconfig sshd on

SSH 啟動
#sudo /sbin/service sshd start

防火牆設定
#sudo vi /etc/sysconfig/iptables

添加下面一行(範例 port = 22)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

重新啟動防火牆
#sudo /sbin/service iptables stop
#sudo /sbin/service iptables start

調整 SSH 設定
#vi  /etc/ssh/sshd_config

禁止 root 通過 SSH 登入
PermitRootLogin no

重新啟動

vsftpd 2.2 in CentOS 6.3


安裝 vsftpd
#yum install vsftpd


設定開機啟動 vsftpd ftp
#chkconfig vsftpd on

啟動服務
#service vsftpd start|restart|stop

修改 server port(注意防火牆設定是否完成)
#vi /etc/vsftpd/vsftpd.conf
在最後一行的地方加上: listen_port=21

新增 ftp 使用者
#vi /etc/vsftpd/vsftpd.conf 
拿掉以下兩個註解: 
chroot_list_enable=YES 
chroot_list_file=/etc/vsftpd.chroot_list 

增加使用者 ftpuser,指向路徑 /home/wwwroot/ftpuser, 禁止使用 SSH 權限 #useradd -d /home/wwwroot/ftpuser -g ftp -s /sbin/nologin ftpuser
(wwwroot需要先用 mkdir 的方式建立)

修改密碼
#passwd ftpuser

編輯文件chroot_list:
#vi /etc/vsftpd/chroot_list

內容為 ftp 帳號,每個帳號都佔一行:
jeff
nina
    登入 ftp 後可轉換至個人目錄
    #setsebool -P ftp_home_dir on

    配置防火牆
    編輯設置文件

    #vi /etc/sysconfig/iptables

    在REJECT行之前加上以下指令(範例是將 21 port 在防火牆開啟)
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

    重新啟動防火牆
    #service iptables start



    2012/10/11

    Bluetooth Support Service Setting


    Bluetooth Support Service Setting

    Part 1 of the solution is buried in this Microsoft Knowledgebase article:
    And I quote:
    How to make sure that the Bluetooth service is started
    1. Open the Microsoft Management Console (MMC) snap-in for Services. To do this, follow these steps.

      Windows Vista or Windows 7
      1. Click StartVista Start Button, copy and then paste (or type) the following command in the Start Search box, and then press ENTER: services.msc
      2. In the Programs list, click Services.
        Security Shield
        If you are prompted for an administrator password or for confirmation, type the password, or click Continue.
      Windows XP
      1. Click Start, and then click Run.
      2. Copy and then paste (or type) the following command in the Open box, and then press ENTER: services.msc
    2. Double-click the Bluetooth Support service.
    3. If the Bluetooth Support service is stopped, click Start.
    4. On the Startup type list, click Automatic.
    5. Click the Log On tab.
    6. Click Local System account.
    7. Click OK.
    8. If you prompted to restart the computer, click Yes.
    My log on settings were okay, but my Startup Type was set to “Manual” rather than “Automatic”. I changed it, like so:
    Bluetooth Support Services Properties

    Bluetooth Power Management Setting

    But sadly, my problem wasn’t solved. So then I tried something else. I opened up Device Manager, expanded “Bluetooth Radios”, and double-clicked on the device to open its Properties page – not the enumerator, the device.
    Double click the device (highlighted), not the enumerator
    Double click the device (highlighted), not the enumerator
    Go to the Power Management page and clear the checkbox “Allow the computer to turn off this device to save power”. And finally, relief! No more disconnects. Apparently there is a bug in the power management of the Bluetooth driver under Windows 7.
    Uncheck 'Allow the computer to turn off this device to save power'
    Uncheck 'Allow the computer to turn off this device to save power'
    I can’t say for sure that the first step of making the Bluetooth Support Service automatic is necessary, or just turning off power management would fix it. It doesn’t hurt to change it to automatic so I didn’t test this. If you test it, post your results. Are both changes needed, or do you just need to turn off power management to stop losing connection?

    文章來自這裡

    2012/08/29

    ㄉㄨㄞㄉㄨㄞ

    Nina Lin, Dazhi, Taipei, Taiwan 一個好吃懶做的米蟲,想吃就吃想睡就睡。 occpuation:公主。interests:吃飯 睡覺 打鼻鼻

    2012/08/22

    XMLBeans command


    install

    scomp -compiler c:\java_tools\java\jdk1.7\bin\javac.exe -out 1sync_xml_datasource.jar schema/common/1.0/AttrTypes.xsd schema/common/1.0/Header.xsd schema/common/1.0/Types.xsd schema/item/1.0/CatalogueRequestProxy.xsd schema/item/1.0/ResponseProxy.xsd schema/item/1.0/Types.xsd

    2012/07/23

    Install PostgreSQL 8.2.23 in CentOS 5.8


    1. Download source files from here
    2. Upload files to the CentOS server
    3. Prepare the necessary files
      1. #yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
    4. #tar -zxf postgresql-8.2.23.tar.gz
    5. #cd postgresql*
    6. #./configure --prefix=/usr/local/pgsql  --without-readline
    7. #make && make install
    8. Setting PostgreSQL config process
      1. create user: #adduser postgres
      2. create password: #passwd postgres
      3. Authorized folder/files: 
        1. #mkdir /usr/local/pgsql/data
        2. #chown -R postgres /usr/local/pgsql
      4. login as postgres: su postgres
      5. initial dataset: /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
      6. edit config
        1. #vi /usr/local/pgsql/data/postgresql.conf
        2. find listen_addresses = ‘localhost’ to listen_addresses = '*'
        3. #vi /usr/local/pgsql/data/pg_hba.conf 
        4. IPv4 local connections:
        5. host    all         all         127.0.0.1/32          trust 
          host    all         all         192.168.1.0/24      password
    9. Update user env. parameters
      1. #vim /var/lib/pgsql/.bash_profile
      2. [ -f /etc/profile ] && source /etc/profile
      3. PGDATA=/usr/local/pgsql/data
        export PATH=/usr/local/pgsql/bin:$PATH
        export PGDATA
    10. Start the service
      1. start SQL service: 
        1. #su - postgres
        2. #/usr/local/pgsql/bin/pg_ctl start -i -D /usr/local/pgsql/data
      2. check SQL status: ps aux | grep postgres
      3. update postgres user
        1. #su - postgres
        2. #psql postgres
        3. #alter user postgres ENCRYPTED PASSWORD 'postgres';

    Note that: you have a short cut to figure out:
    command line: yum -y install postgresql postgresql-libs postgresql-server

    2012/07/20

    Install Tomcat 6 in CentOS 5.8


    1. Install Tomcat 6 Process
      1. cd /etc/yum.repos.d
      2. wget 'http://www.jpackage.org/jpackage50.repo'
      3. yum update
      4. yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
      5. service tomcat6 start
    2. If you have problems accessing the server from another machine you may need to do the following:
      1. setup
      2. "Firewall configuration"
      3. "Customize"
      4. "Other ports" 8080:tcp
      5. "Ok"
      6. service tomcat6 restart
    3. If you get a dependency error:
      1. rpm -Uvh 'http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm'
    4. tomcat_home: /usr/share/tomcat6
    5. "tomcat" is a default execute tomcat server user.

    Install JDK 1.6 in CentOS 5.8



    1. Download jdk(jdk-6u33-linux-i586-rpm.bin) from Java Sun
      1. cd  /root
      2. cp jdk-6u33-linux-i586-rpm.bin /usr/local
      3. cd /usr/local
      4. chmod   +x  jdk-6u33-linux-i586-rpm.bin
      5. ./ jdk-6u33-linux-i586-rpm.bin
    2. Test JDK
      1. By default Java will be installed to /usr/java/jdk1.6.0_33/
      2. /usr/java/jdk1.6.0_33/bin/java -version
    3. Choosing JDK
      1. alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_33/bin/java 2
      2. alternatives --config java
    There are 3 programs which provide 'java'.
      Selection    Command
    -----------------------------------------------
    *+ 1         /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
       2           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
       3           /usr/java/jdk1.6.0_33/bin/java
    Enter to keep the current selection[+], or type selection number: 3

    Done!

    2012/04/12

    Uninstall PostgreSQL 8.2 for MAC 10.6.8

    Steps to uninstall PostgreSQL 8.4 (Assuming default locations) 

    1) Stop the server and remove the service. 

    sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist 

    2) Remove the plist file. 

    sudo rm -f /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist  

    3) Remove the Menu Icons 

    sudo rm -rf /Applications/PostgreSQL/8.4

    4) Remove the Installation Files. 

    sudo rm -rf /Library/PostgreSQL/8.4  

    5) Remove the postgres user. 

    sudo dscl . delete /Users/postgres  

    6) Remove the ini file 

    sudo rm -f /etc/postgres-reg.ini  


    This will uninstall PostgreSQL 8.4 cleanly from your mac. 

    NGINX SSL/設定檔案

    #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #...