[Windows] 環境變數設定(Environment Variables) – 如php, mysql, cygwin cmd.

Intro 一般應用在使用如Xampp的php想要有alias指令,或像Cygwin執行檔環境變數問題。 Windows10環境變數設定選單: “My Computer” -> Properties -> Advanced -> Environment Variables 或 “Control Panel\System and Security\System” -> Advanced system settings -> Advanced -> Environment Variables 效益上就是要達到SET PATH=%PATH%;C:\your,差異在設定方式會是永久保存。 環境變數設定 可以先看到分User variables與System variables,一般我們只需要異動使用者的。 變數Path Path變數提供類似Command Alias功能, 實作上例如安裝Xampp後期待可以透過cmd輸入php,mysql等alias執行相依程式。 以PHP安裝在D:\xampp\php\目錄舉例,在環境變數設定介面選擇Path的變數進行編輯,可以新增一行: D:\xampp\php 儲存後,可以在cmd下測試輸入php -v是否有成功。

[Apache] CPanel & .htaccess & php.ini 應用指南

Intro CPanel的網頁伺服器是使用Apache搭建,可以支援.htaccess & php.ini的應用。 .htaccess 為Apache開啟AllowOverride後支援的檔案目錄設定檔功能,每個目錄皆能Override 以常見的轉導應用為例,.htaccess可參考以下: RewriteEngine On # 301 Redirect (Comment out) # redirect 301 / https://www.google.com # non-www redirect to www RewriteCond %{HTTP_HOST} ^yourname.com [NC] RewriteRule ^(.*)$ https://www.yourname.com/$1 [L,R=301] [Apache][.htaccess] 停用PHP – Disable PHP .htaccess file gives […]

[lftp] LFTP指令指南|mirror鏡像 – lftp Command Guide

LFTP連線 | 基本操作 | 連線設定 | FTPS| SFTP Intro lftp在這年頭還是有機會用到,像被綁架的主機環境僅提供FTP Access。 至於為何使用lftp? 使用過ftp就知道…連folder控制都成問題。 文件:LFTP – the manual page lftp連線 lftp [-d] [-e cmd] [-p port] [-u user[,pass]] [site] For example: lftp www.yourdomain.com -u username,password 也可以先連線至site後再使用login: lftp www.yourdomain.com login <user> [<pass>] […]

[Linux] 網路卡設定 – Network Configuration – CentOS/Ubuntu

CentOS 官網文件:14.1. Network Configuration Files Path: /etc/sysconfig/network-scripts/ 依照每張網卡擁有各自設定檔: ifcfg-eth0 ifcfg-eth1 新增流程: 如上格式新增完成一張網卡設定檔後,啟用該編號 ifup eth1 設定範例: DEVICE=eth1 BOOTPROTO=static ONBOOT=yes IPADDR=192.168.0.100 NETMASK=255.255.255.0 Centos 預設 ONBOOT 是關閉的,開啟才能開機自動啟用網卡 Debian resolv.conf – Debian Wiki networking – Where should I configure DNS in Debian 11? – […]

[Windows] Win10 Home安裝啟用GPEdit.Msc (Group Policy Editor)

Intro Windows 10 Home可沒有gpedit.msc,需要另外手動安裝。 安裝啟用 下載GPEdit.Msc啟用BAT檔: GPEdit Enabler for Windows 10 Home Edition 使用管理員權限(使用到DISM)執行安裝並重開機後,Windows Run即可支援gpedit.msc BAT原理 怕載點失效嗎? 原理就只是執行已安裝OS內的Package,所以自己生成的BAT Commands為: @echo off pushd “%~dp0” dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt for /f %%i in (‘findstr /i . List.txt 2^>nul’) […]

[Dism] 查看Windows 10映像檔版本 – Check build and edition of Windows 10 iso

方法 可以直接以Windows打開ISO檔,ISO將會被自動掛載至新磁碟區 承上,掛載後即有絕對路徑如: H:\sources\install.esd 以磁碟H為範例 使用管理者權限執行dism確認檔案(cmd模式執行): Info with OS Build Version: dism /Get-WimInfo /WimFile:H:\sources\install.wim /index:1 If not found, use install.esd dism /Get-WimInfo /WimFile:H:\sources\boot.wim /index:1 Combo ISO: dism /Get-WimInfo /WimFile:H:\x86\sources\install.esd /index:1 dism /Get-WimInfo /WimFile:H:\x64\sources\install.esd /index:1 dism /Get-WimInfo /WimFile:H:\x86\sources\boot.wim /index:1 dism /Get-WimInfo […]

[Iptables] 防火牆設定指南 – iptables for CentOS & Ubuntu

Introduction CentOS & Ubuntu iptables guide. 其中CentOS我認為較方便設定。 指令與參數 快速阻擋一組IP(1.2.3.4/32)的所有連線: $ iptables -A INPUT -s 1.2.3.4/32 -j DROP 常用參數: –append -A :新增至Chain (預設`INPUT`, `FORWARD`, `OUTPUT`) –source -s :IP soruce –protocol -p :protocal –dport :目的Port,指服務Port (`–destination-port`) –jump -j :目標規則 (`ACCEPT`, `DROP`) 設定檔 […]

[Linux] 快速查詢Linux發行版本與名稱(release & lsb_release)

引言 快速查詢各Linux發行版本與名稱,忘記時的好幫手… 查詢 快速指令lsb_release lsb_release -a 一般適用於Debian系列,Centos可能沒有。查詢結果範例: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: xenial 通用查詢/etc/*-release ls -l /etc/*-release 不同的版本會有不同的*前綴,且最好查看內容別直接以前綴名稱當成版本。Centeos查詢結果範例: -rw-r–r–. 1 root root 27 2017-03-28 18:25 /etc/centos-release lrwxrwxrwx. 1 root root […]