Skip to content

Conversation

@Alireza-Gholiei
Copy link
Contributor

This PR adds native Windows compatibility for Nginx-UI, fixing the following error when reloading Nginx on
Windows:

Nginx error: exec: "/bin/sh": executable file not found in %PATH%

Updated execShell in internal/nginx/exec.go
to use cmd /C instead of /bin/sh -c when running on Windows.

This makes ReloadCmd, RestartCmd, and other Nginx commands work properly on Windows environments.

Implementation Detail

func execShell(cmd string) (stdOut string, stdErr error) {
    if runtime.GOOS == "windows" {
        return execCommand("cmd", "/C", cmd)
    }
    return execCommand("/bin/sh", "-c", cmd)
}

Added import "runtime" for OS detection.

Tested Environment

OS: Windows 10 / Windows Server 2019

Nginx: Windows build (nginx.exe)

Result:

Reload and Restart work correctly

UI responds successfully

No /bin/sh errors

@0xJacky
Copy link
Owner

0xJacky commented Oct 12, 2025

LGTM 🎉

@0xJacky 0xJacky merged commit 9eb759d into 0xJacky:dev Oct 12, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants