如何让windows上的nginx绑定端口?
var writeFileSync = function (path, buffer, permission) {
permission = permission || 438; // 0666
var fileDescriptor;
try {
fileDescriptor = fs.openSync(path, 'w', permission);
} catch (e) {
fs.chmodSync(path, permission);
fileDescriptor = fs.openSync(path, 'w', permission);
}
if (fileDescriptor) {
fs.writeSync(fileDescriptor, buffer, 0, buffer.length, 0);
fs.closeSync(fileDescriptor);
}
}
// then writeFileSync('path_to_your_file', your_buffer);
答案 0 :(得分:2)
看起来nginx或其他进程已经在侦听该端口了。为了确定正在侦听该端口的内容,请尝试以下命令:
sudo netstat -nltp
然后您可以通过终止相应的进程释放端口,其中< PID>是上述命令中的processID:
kill -TERM <PID>