简体   繁体   中英

Docker Compose LAMP stack not serving index.php

I'm doing some freelance work and the people I'm working with use a LAMP stack with docker. I've never used docker before and I am having some issues. They all use Macs, while I have windows so they have not been able to help me. I've been working on this on and off for the last 12 hours and cannot get my index.php page to show up. I'll go over the steps I've taken so far and provide the file structure.

I was working in windows powershell

  1. Installed Docker Desktop from here
  2. I followed the steps here to create a new docker-machine

    2a. The command I ran was 'docker-machine create -d hyperv --hyperv-virtual-switch "DockerVS" default'

  3. I then ran 'docker-machine env'

  4. Then I ran '& "C:\\Program Files\\Docker\\Docker\\Resources\\bin\\docker-machine.exe" env | Invoke-Expression'

  5. Then, while in the same directory, I grabbed the project from GitHub, changed directory into the location with the .env and docker-compose.yml files. then ran the command 'docker-compose up -d'

  6. At this point, I was supposed to be able to run 'docker-machine ip default' , paste that IP into my browser and see the page. That is what all my coworkers had done with their macs, at least. If it matters, the IP is 10.0.0.117

Now something is definitely running there, it attempts to get the "index.php" file, but it returns "File not found" to the browser. The page is also running phpMyAdmin, so if I type in 10.0.0.117:8080 to the browser, I see this page . So I'm confident that I'm on the right track, I just assume I've done something minor.

So the solutions I've attempted. My first guess was that I needed a port similar to :8080 that make the php page pop up. I ran 'docker-compose ps ' and I tried the ports 443, 3360, and 9000 which I all see here: 在此处输入图片说明

Naturally no go. Next I tried various paths, and then tried all the aforementioned ports and paths together. The paths I tried were

  • /index.php
  • /index.html
  • /index
  • /index.htm
  • The above four with /public-html in front
  • The above with /LAMPProject in front

The file structure looks like this: 在此处输入图片说明

So all in all, that is what I am working with. It's a fairly simple docker LAMP set up before I start working on bigger stuff. Any advice at all would be very welcome.

我认为您应该将 phpmyadmin 端口映射到另一个端口,例如 8081 而不是 80,apache 容器也映射到 80。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM