Reading: 001._Portable_Apache_PHP_ApacheLightHttpdServer.txt
← Back
; 23.04.2026.11.40.wib [Indonesia]
; Portable Apache+PHPnoMySQL: ApacheLightHttpdServer - Hooyaa Edition
!include "LogicLib.nsh"
!include "MUI2.nsh"
Name "ApacheLightHttpdServer"
OutFile "ApacheLightHttpdServer_Setup_Installer.exe"
RequestExecutionLevel user
SetCompressor LZMA
!define APPFOLDER "ApacheLightHttpdServer"
!define PORT "8125"
# MUI Interface
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Section "MainApp"
SetOutPath "$INSTDIR"
File /r "ApacheLightHttpdServer\*"
# Create portable flag
FileOpen $0 "$INSTDIR\portable.dat" w
FileWrite $0 "GOODNESS_WISENESS"
FileClose $0
# Create start script
FileWrite "$INSTDIR\start.bat" '$$INSTDIR\apache\bin\httpd.exe'
FileWrite "$INSTDIR\stop.bat" 'taskkill /f /im httpd.exe'
# Add to startup (optional)
CreateShortCut "$SMPROGRAMS\ApacheLightHttpdServer.lnk" "$INSTDIR\start.bat"
CreateShortCut "$SMPROGRAMS\ApacheLightHttpdServer.lnk" "$INSTDIR\stop.bat"
MessageBox MB_OK "ApacheLightHttpdServer Installation complete! Run start.bat to launch."
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\portable.dat"
Delete "$INSTDIR\start.bat"
Delete "$INSTDIR\stop.bat"
RMDir /r "$INSTDIR"
SectionEnd
Function .onInit
# Kill any running httpd on port ${PORT}
execwait 'taskkill /f /im httpd.exe'
FunctionEnd
------------------------------------------------------------------------------------- installer.nsi
Listen 8125
ServerName 127.0.0.1:8125
DocumentRoot "../htdocs/chatoffline"
<Directory "../htdocs/chatoffline">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
------------------------------------------------------------------------------------- httpd.conf
@echo off
echo Checking for process on port 8125...
for /f "tokens=5" %%T in ('netstat -aon ^| findstr :8125') do (
set PID=%%T
)
if defined PID (
echo Killing process %PID% on port 8125...
taskkill /f /pid %PID%
) else (
echo No process found on port 8125.
)
pause
------------------------------------------------------------------------------------- kill_port.bat
@echo off
cd /d "%~dp0"
apache\bin\httpd.exe
------------------------------------------------------------------------------------- start.bat
@echo off
for /f "tokens=5" %%T in ('netstat -ano ^| findstr ":8125" ^| findstr "127.0.0.1"') do (
taskkill /f /pid %%T >nul 2>&1
)
------------------------------------------------------------------------------------- stop.bat
CreateObject("WScript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
------------------------------------------------------------------------------------- start.vbs
CreateObject("WScript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
----------------------------------------------------
!include "MUI2.nsh"
!include "nsExec.nsh"
Name "ApacheLightHttpdServerDaemon"
OutFile "ApacheLightHttpdServerDaemon.exe"
RequestExecutionLevel user
SetCompressor LZMA
# Disable installer pages (pure executable)
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE HidePages
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function HidePages
Abort
FunctionEnd
Section "Main"
SetOutPath "$EXEDIR"
File /r "ApacheLightHttpdServer\*"
# Create batch files
FileOpen $0 "$EXEDIR\start.bat" w
FileWrite $0 "@echo off$\r$\n"
FileWrite $0 'cd /d "%~dp0" $\r$\n'
FileWrite $0 'apache\bin\httpd.exe'
FileClose $0
FileOpen $0 "$EXEDIR\stop.bat" w
FileWrite $0 "@echo off$\r$\n"
FileWrite $0 'for /f "tokens=5" %%T in ('\'
FileWrite $0 'netstat -ano ^| findstr ":8125" ^| findstr "127.0.0.1"'
FileWrite $0 ') do taskkill /f /pid %%T >nul 2>&1'
FileClose $0
# Show tray icon with menu
System::Call 'kernel32::GetCurrentProcess() i.s'
Push $s
Call ShowTrayIcon
SectionEnd
Function ShowTrayIcon
Push $0
# Add icon to tray with context menu
NotifyIcon::Icon "ym" $0 "ApacheLightHttpdServerDaemon" "f$EXEDIR\apache\bin\httpd.exe" "i1"
# Menu: Start Server
Menu::AppendItem $0 "Start Server" 100
# Menu: Stop Server
Menu::AppendItem $0 "Stop Server" 101
# Handle clicks
Menu::SetClick 100 "StartServer"
Menu::SetClick 101 "StopServer"
# Show menu on right-click
NotifyIcon::ShowContextMenu
FunctionEnd
Function StartServer
nsExec::Exec '"$COMSPEC" /c start.bat'
FunctionEnd
Function StopServer
nsExec::Exec '"$COMSPEC" /c stop.bat'
FunctionEnd
Function .onGUIEnd
# Clean up tray icon
NotifyIcon::Icon "r"
FunctionEnd
-------------------------------------------------------------------------------------ApacheLightHttpdServerDaemon.nsi
done make no:Autorun AND no:Installer but pure exe/.exe but make script ApacheLightHttpdServerDaemon.exe/ApacheLightHttpdServerDaemon.nsi for Daemon WIndows10/11 on below right corner taskbar Windows10/11, add right click, Start:start.bat AND Stop:stop.bat