簡體   English   中英

在適用於Linux的Windows子系統上安裝Apache

[英]Installing Apache on 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!

現在,我知道Apache2似乎缺少一些文件夾和文件。 在我開始更改任何會破壞我的Windows安裝的東西之前,我想問一下是否有不同的方法? 另外,我應該擔心/可寫組還是僅僅是標准的Windows行為?

為了消除這個警告

Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEP

將其添加到/etc/apache2/apache2.conf的末尾

AcceptFilter http none

您必須以管理員模式啟動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

請注意輸出中的以下內容

failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file 

我試過列出/ var / lock。 它指向/ run / lock,它不存在。

使用創建目錄

mkdir -p /run/lock

安裝現在應該可以工作(您可能需要先清理安裝)

在Windows Ubuntu上運行的apache

按照這里的好建議,我編輯了apache2.conf並在收到上面的所有各種錯誤之后將以下內容插入到文件末尾,然后apache2在debian wsl包上運行得很好:

Servername localhost
AcceptFilter http none
AcceptFilter https none

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM