by Rain Chu | 9 月 6, 2023 | IIS , PHP
最近遇到 PHP 太吃記憶體的問題,我除了在php.ini 中設定 limit memory 以外,也打算在 IIS 中把總量的記憶體限制住,避免讓主機的記憶體爆滿,而當機,可以在記憶題超過限制後,把自己行程回收。
設定方法 在管理介面中,找到 「Advanced Settings」 ,進去後往下滑找到 「Private Memory Limit (KB)」 ,這邊這個數值是 KB 為主,如果希望將 Private Memory Limit (KB)
設定為 10GB,您需要將其設定為 10485760
KB 設定公式如下
10 GB = 10 * 1024 * 1024 KB = 10485760 KB 我設定的邏輯是觀察主機上所有的 Application Pool 會用到多少的記憶體,然後去分配她
by Rain Chu | 4 月 28, 2023 | IIS , Windows
現在的網站一定都要有https的協定才會是安全的,SEO的分數也才會高,在IIS內可以直接透過 URL rewrite 來將 http 連線都轉換成 https 連線,過程比 nginx 要麻煩一點,但有圖形化的介面設定,也是蠻容易上手的
打開 IIS Manager 找到 URL Rewrite 先假設你已經完成了 URL Rewrite 的安裝,則可以在介面中看到 URL Rewrite的設定
建立新的規則 (Add Rule) 在右邊的 Actions 選擇 Add Rule(s),並且選擇 Blank rule
建立 Inbound Rule 如下圖,下拉方塊中選擇 Match URL,並且在 Pattern 中填入 (.*) ,然後移到下方 Conditions 選擇 Add
並且在 Condition input 填入 {HTTPS} ,在 Pattern 中填入 ^OFF$ ,下拉選單中則是選擇 Matches the Pattern
設定 Action 輸入網址的條件設定完之後,要來設定符合的網址要如何處理,如何做動作,參考下圖,Action type 的下拉選單,選擇 Redirect
並且在 Redirect URL 中,填入 https://{HTTP_HOST}/{R:1} ,並且到 Redirect type 下拉選單中選擇 Permanent(301) 後即可以存檔 (Apply)
Web.Config 中的 rewrite 用 iis manager 設定完畢後,你就可以在 web.config 中看到剛剛所做的設定
<rewrite>
<rules>
<clear />
<rule name="http2https" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite> 參考資料
https://aboutssl.org/iis-redirection-http-to-https/
by Rain Chu | 2 月 24, 2023 | Windows
如果你在升級或是安裝Windows 11的時候,出現 cFosSpeed Driver 不支援的錯誤訊息的話,又跟我一樣是華碩的電腦,因為華碩的安裝程式會預設幫你安裝 Turbo LAN ,這套軟體是 ASUS 跟 cFosSpeed 取得授權並且提供給使用者用,但無奈的是會跟 Windows 11 起衝突,要解決問題的話,可以跟著我的步驟來解決這件事情。
cFosSpeed Driver 跟 windows 11 起衝突 1.先檢查你的網路連線 Network Connections 用 Win+R ,輸入 ncpa.cpl ,然後找到你正在使用的網路,並且移除 cFosSpeed 連線
移除 cFosSpeed 連線 2.開啟工作管理員移除開機就執行 cFosSpeed 停用 cFosSpeed Window 服務 3.到應用程式與功能中移除 Turbo LAN 移除 Turbo LAN 程式 4.安裝最新版本的 cFos Speed https://www.cfos.de/zh-tw/cfosspeed/cfosspeed.htm
5.利用新版本的 cFos Speed 的移除程式,解除安裝即可 參考資料
https://www.technewstoday.com/cfosspeed-driver-windows-11/
by Rain Chu | 1 月 19, 2023 | IIS , PHP , web , Windows , wordpress
在 windows server 的 iis 下,預設情況下安裝 php 架構的 wordpress 總是會遇到很多的困難,像是如果遭遇到想要訪問 wordpress 目錄下的目錄資料,例如:https://rain.tips/uploads/,會跟你說找不到資料,原因是wordpress所有的入口要先透由 index.php 去做路由,解決方案則是用 web.config 去指定路由要透過 index.php 即可
請在web.config檔案中添加 rewrite rules
<rewrite>
<rules>
<rule name="WordPress: https://yoururl.com" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite> 最後會長成這樣子
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress: https://yoururl.com" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration> 同場加映
by Rain Chu | 11 月 15, 2022 | Azure , Microsoft , SERVER , Windows
預設在 Microsoft Azure 的 VM 中,ICMP服務協定是關閉的,但常常有需要用ping指令來確認服務是否還存在,打開方法不講的話要找很久,原則上只要在 Azure 中設定,並且到 VM 中將防火牆打開即可
1.Azure中的設定 找到「VM」的「網路」,選擇「新增輸入連接埠規則」
並且輸入any和*
2.Windows Server Firewall 防火牆設定 新增 Inbound Rules ,把ICMPv4和ICMPv6兩個協定加入即可
ICMP 協定
by Rain Chu | 3 月 7, 2022 | IIS , PHP , wordpress
很少人使用 IIS 架設 wordpress ,因為文件不好找,例外狀況又多,這次又發現 WordPress 的 Route 規則怪怪的,會在所有路徑中出現 index.php? ,這才意識到之前用 nginx 時候這些規則都早就解決,只要研究如何處理這樣的困境,研究之後得到有三個要點。
IIS 需要有 URL rewrite 擴充 WordPress 後台要去「設定->永久連結」設定自訂結構 WordPress 中的 web.config 需要加入 rewrite rule
先安裝 IIS 的 URL Rewrite 回到 WordPress 的後台設定永久連結 更改 web.config 設定 rewrite rule <rewrite>
<rules>
<rule name="WordPress: https://yourdomain.com" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite> Apache and Nginx 的設定作法
https://www.php.cn/cms/wordpress/459657.html
近期留言