dpnw86361 2019-06-25 15:26
浏览 2547

在WSL上进行基本安装后,Localhost无法正常工作

I am trying to install a LAMP working environnement but for some reason nothing happen. The lack of error messages makes me wonder what to look for.

I followed the Ubuntu installation process :

sudo apt install apache2 php libapache2-mod-php mysql-server php-mysql

At that stage, localhost should display the "It works!" message but it doesn't.

I have been restarting the apache service several times with no effect:

sudo service apache restart

it looks to be fine anyway.

I have checked the following files as advices on some online tutorial :

/etc/apache2/sites-available/000-default.conf
/etc/apache2/apache2.conf

I am atually clueless on what to troubleshoot at that point.

Any ideas ?

  • 写回答

1条回答 默认 最新

  • duanlou7910 2019-06-25 16:50
    关注

    You have apache2 installed. Try running this instead: sudo service apache2 restart

    I tried installing LAMP on WSL too. But I was lucky. I followed these steps:

    Step 1: Update and Upgrade the ubuntu subsystem

    sudo apt-get update && sudo apt-get upgrade
    

    Step 2: Start bash.exe type:

    sudo apt-get install lamp-server^
    

    remember the caret (^) at the end of the command.

    add these 2 lines in /etc/apache2/apache2.conf :

    Servername localhost
    AcceptFilter http none
    

    then you can start apache :

    /etc/init.d/apache2 start
    

    Step 3: Test Web Server, PHP and MySQL Test Apache: Open Web Browser and type this URL:

    http://127.0.0.1 or http://localhost
    

    Test PHP: Create below file (info.php) and place it in /var/www/html

    <?php
    phpinfo();
    ?>
    

    Open Web Browser and type this URL:

    http://127.0.0.1/info.php or http://localhost/info.php
    

    Test MySQL: Type below command in bash prompt

    service mysql start
    mysql -uroot -ppassword
    

    Hope it works for you.

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大