2017年3月7日 星期二

NGINX 反向代理設定

編輯NGINX網站設定檔 
vim /etc/nginx/sites-available/default
將設定加入最後面


location / {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      # Fix the “It appears that your reverse proxy set up is broken" error.
      proxy_pass          http://Domain_or_IP;
      proxy_read_timeout  90;

      proxy_redirect      http://Domain_or_IP  https://Domain_or_IP;
    }

最後重新啟動 nginx 服務:
sudo service nginx restart

NGINX SSL設定

安裝NGINX

sudo apt-get update
sudo apt-get install nginx

版本查詢
nginx -v

產生私鑰目錄
cd /etc/nginx/ssl

產生私鑰
openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr

example_com.key         所產生的金鑰CODOMO將會連線驗證ngxinx SSL。
example_com.csr          CSR文件。(貼於CODOMO才能產生網頁驗證檔如下圖)









下載憑證放置於/etc/nginx/ssl
憑證內容
根CA證書 - AddTrustExternalCARoot.crt
中級CA證書 - COMODORSAAddTrustCA.crt
中級CA證書 - COMODORSADomainValidationSecureServerCA.crt

PositiveSSL證書 - www_example_com.crt(自己建立的子網域名稱)
合併憑證檔
1.將上述crt文件合併成一個ssl-bundle.crt(順序很重要):
  1. cat www_example_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt> ssl-bundle.crt
2.將ssl-bundle.crt放置在/etc/nginx/ssl的位置
編輯NGINX網站設定檔 
vim /etc/nginx/sites-available/default
增加以下名稱內容
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;
        ssl_certificate_key /etc/nginx/ssl/example_com.key;
        ssl_certificate /etc/nginx/ssl/ssl-bundle.crt;

最後重新啟動 nginx 服務:
sudo service nginx restart

這樣即可完成憑證設定!



2017年1月4日 星期三

AirDrop 找不到 iPhone / Mac ?

https://support.apple.com/zh-tw/HT203106

https://www.newmobilelife.com/2015/12/03/5-step-check-airdrop/

http://km.nicetypo.com/doc/7090786787135be8d32fa6624b892309

2016年12月26日 星期一

Windows 2016 OFFICE ISO DownLoad

https://heidoc.net/joomla/technology-science/microsoft/8-office-2016-direct-download-links

2016年12月20日 星期二

Windows 10 iTunes抓不到iPhone or iPAD週邊

至裝置管理員>重新裝APPLE 設備的驅動程式

瀏覽選取以下路徑:C:\Program Files\Common Files\Apple\Mobile Device Support\Drivers 選取Apple Mobile Device USB Driver  即可。



2016年11月28日 星期一

Ubuntu 16.04 phpmyadmin for php5 不正常時補裝元件

當裝完phpmyadmin後資料庫管理介面畫面空白請補裝以下元件

sudo apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0

請重啟apache2

sudo systemctl restart apache2
如果還是看不到,請重新啟用 PHP mcrypt and mbstring 元件

sudo phpenmod mcrypt
sudo phpenmod mbstring
請重啟apache2

sudo systemctl restart apache2


Ubuntu 16.04 php更換成php5版本


1
2
sudo apt-add-repository -y ppa:ondrej/php
sudo apt-get -y update
3
sudo apt-get -y install php7.0 php5.6-mysql php5.6-cli php5.6-curl php5.6-json php5.6-sqlite3 php5.6-mcrypt php5.6-curl php-xdebug php5.6-mbstring libapache2-mod-php5.6 libapache2-mod-php7.0 mysql-server-5.7 apache2
4
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ;
sudo service apache2 restart ;
echo 1 | sudo update-alternatives --config php
5
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ;
sudo service apache2 restart ;
echo 2 | sudo update-alternatives --config php

6



7


alias phpv5='sudo a2dismod php7.0 ; sudo a2enmod php5.6 ;
sudo service apache2 restart ;
echo 1 | sudo update-alternatives --config php'

alias phpv7='sudo a2dismod php5.6 ; sudo a2enmod php7.0 ;
sudo service apache2 restart ;
echo 2 | sudo update-alternatives --config php'

8
9
10
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
sudo service apache2 restart

參考網站:https://www.phpini.com/php/ubuntu-16-04-xenial-xerus-apache-mysql-php-lamp