Skip to content

Zeroplex 生活隨筆

軟體開發、伺服器和生活瑣事

小 縮小字型大小。 中 重設字型大小。 大 放大字型大小。

Nginx 將 HTTP 轉向 HTTPS

Posted on 2013 年 10 月 8 日2021 年 3 月 12 日 By 日落 在〈Nginx 將 HTTP 轉向 HTTPS〉中有 1 則留言

看了「Switch to HTTPS Now, For Free」後,到 StartSSL 將手上幾個常用的網域都申請了 SSL 憑證。

SSL 憑證上線使用後,再來就讓任何 HTTP 連線都可以導到 HTTPS。

server {
   location / {
      # rewrite ^ https://my.url;
      rewrite ^ https://$server_name permanent;
   }
}

或者要將網址後半部的參數一起轉過去:

location {
   rewrite ^ https://$server_name$request_uri permanent;
}

note: 「permanent」會發送 HTTP 301

Ref:
Nginx HttpRewriteModule
http://wiki.nginx.org/HttpRewriteModule

Tags:Nginx

List Disk Label

Posted on 2013 年 9 月 29 日2021 年 3 月 12 日 By 日落 在〈List Disk Label〉中尚無留言

Linux 要掛載磁碟機,通常都是使用 /dev 底下的裝置名稱:

mount /dev/sdb /media/backup

但磁碟機一多,常常會搞不清楚裝置名稱與磁碟機的對應。

Linux 上除了裝置名稱以外,有為 disk label 建立 mapping,當作掛載時的參考:

mount /dev/disk/by-label/System-Backup /media/backup

另外還有「by-uuid」、「by-path」可用。

Tags:Linux

URL Rewrite for FuelPHP on Nginx

Posted on 2013 年 9 月 29 日2021 年 3 月 12 日 By 日落 在〈URL Rewrite for FuelPHP on Nginx〉中尚無留言

在 Nginx 設定檔預設值時,FuelPHP 的 URL 看起來是:

http://my.site/index.php/controller/param/

將 URL rewrite 成:

http://my.site/controller/param/

先改 Nginx 設定:

location / {
   try_files  $uri /index.php?$uri$args;
}

這樣能讓 Nginx 處理不含 index.php 的 URL,再來需要修改 FuelPHP 的設定,讓 Uri::create() 等產生的網址自動將 index.php 去掉。

修改 fuel/app/config/config.php:

return arary(
   //'index_file'  => 'index.php',
   'index_file'  => false,
);
Tags:FuelPHP, Nginx

Setting Vim from Command Line Argument

Posted on 2013 年 9 月 3 日2021 年 3 月 12 日 By 日落 在〈Setting Vim from Command Line Argument〉中尚無留言

因不同環境編碼不同,而需要從外部程式呼叫 vim 時直接設定編碼。苦想不到解法時,看到 NeoBundle 第一次執行 vim 要安裝 bundle 時,執行「vim +NeoBundleInstall」,翻了很久才找到「+」的說明文件 (天曉得為什麼要用 :h -c 才能找到文件啊 ….)

假設要在 vim 中執行「:set fileencoding=utf-8」,可以改做由 command line 執行:

vim +fileencodeing=utf-8

所以稍早在 .bashrc 裡面加了:

export SVN_EDITOR="vim +"fileencoding=utf-8 encoding=utf-8""
Tags:Linux, Vim

Set Remote Default Port for SSH Client

Posted on 2013 年 8 月 21 日2021 年 3 月 12 日 By 日落 在〈Set Remote Default Port for SSH Client〉中尚無留言

若 sshd 改成非 port 22,不少 ssh client 操作會變成很麻煩。

但可以在 .ssh/config 設定 host name 和 url、port,之後就可僅用 host name 連線。

vim ~/.ssh/config :

Host hq
HostName server.url
Port 9999
User zero

之後要連線時打「hq」即可:

  • ssh hq
  • git remote add origin hp:/path/to/repository

Reference:
git – Using a remote repository with non-standard port – Stack Overflow

Tags:Linux

文章分頁

上一頁 1 ... 115 116 117 ... 318 下一頁

其他

關於我  (About me)

  文章 RSS Feed

  留言 RSS Feed

Apache AWS Bash C/C++ Docker FreeBSD GCP Git Google Java JavaScript Laravel Linux Microsoft MSSQL MySQL Nginx PHP PHPUnit PostgreSQL Python Qt Ubuntu Unix Vim Web Windows WordPress XD 作業系統 分享 好站推薦 專題 攝影 新奇搞笑 新聞 旅遊 生活雜記 程式設計 網路架站 網頁設計 資訊學習 資訊安全 遊戲 音樂


創用 CC 授權條款
本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權.