在适用于Linux的Windows子系统上安装Apache

blu*_*isk 26 linux windows apache2 subsystem windows-subsystem-for-linux

刚刚更新到最新的Windows 10版本(build 14316),我立即开始使用WSL,Windows子系统Linux,它应该在Windows上运行Ubuntu安装.

也许我正在尝试在其上安装Apache,但是有人请解释我为什么这是不可能的.

无论如何,在安装过程中(sudo apt-get install apache2),我在下载并正确安装依赖项后收到以下错误消息:

initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
runlevel:/var/run/utmp: No such file or directory
 * Starting web server apache2                                                 *
 * The apache2 configtest failed.
Output of config test was:
mktemp: failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file or directory
chmod: missing operand after '755'
Try 'chmod --help' for more information.
invoke-rc.d: initscript apache2, action "start" failed.
Setting up ssl-cert (1.0.33) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
WARN: / is group writable!
Run Code Online (Sandbox Code Playgroud)

现在,我知道Apache2似乎缺少一些文件夹和文件.在我开始更改任何会破坏我的Windows安装的东西之前,我想问一下是否有不同的方法?另外,我应该担心/可写组还是仅仅是标准的Windows行为?

小智 49

为了消除这个警告

Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEP
Run Code Online (Sandbox Code Playgroud)

将此添加到结尾 /etc/apache2/apache2.conf

AcceptFilter http none
Run Code Online (Sandbox Code Playgroud)

  • 这究竟是做什么的? (5认同)

cet*_*abo 16

您必须以管理员模式启动bash.exe以避免许多与网络相关的问题.我安装Lamp(Apache/MySQL/Php)没有任何问题:

  • 以管理员模式启动bash.exe

  • 类型:sudo apt-get install lamp-server ^

  • /etc/apache2/apache2.conf中添加以下两行:

Servername localhost

AcceptFilter http无

那么你可以启动apache: /etc/init.d/apache2 start

  • 谢谢(你的)信息.这对我来说甚至可以在没有管理员模式的情况下工作.**唯一的区别是,我在安装后立即重新启动了Apache.** (2认同)

Ere*_*orn 15

请注意输出中的以下内容

failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file 
Run Code Online (Sandbox Code Playgroud)

我试过列出/ var/lock.它指向/ run/lock,它不存在.

使用创建目录

mkdir -p /run/lock
Run Code Online (Sandbox Code Playgroud)

安装现在应该可以工作(您可能需要先清理安装)

在Windows Ubuntu上运行的apache

  • 你是对的,Skype正在收听端口80.非常感谢 (2认同)