簡體   English   中英

Nginx index.html而不是我自己的index.html

[英]Nginx index.html instead of my own index.html

我一直在嘗試通過以下鏈接獲取有關docker的教程: http : //geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/

但是,我陷入了在/ code路徑中顯示自己的index.html的問題。 而是顯示“歡迎使用nginx!”頁面。 我所有的文件都與鏈接中的相同。 我的文件包含一個代碼文件夾(里面是我的index.html),docker-compose,site.conf,與鏈接相同。

我進行了搜索,並嘗試了許多方法,但無法正常工作。 謝謝有人能為我指明前進的方向。

我在Windows OS上使用docker工具箱。

這里提供的是site.conf和docker-compose.yml的配置文件

#site.conf
server {
    index index.html;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /code;
}

#docker-compose.yml
web:
    image: nginx:latest
    ports:
        - "8080:80"
    volumes:
        - ./code:/code
        - ./site.conf:/etc/nginx/conf.d/site.conf

作為寫博客文章的人,看到這個問題既讓我感到興奮又感到羞愧😅

要回答您的特定問題-您需要做兩件事:

  1. 忘記php-docker.local 我看到它不再存在於您的Nginx配置中,所以我想您應該不錯
  2. 您應該將./site.conf:/etc/nginx/conf.d/site.conf docker-compose.yml./site.conf:/etc/nginx/conf.d/site.conf部分更改為./site.conf:/etc/nginx/conf.d/default.conf

這兩個步驟簡化了流程,並允許您訪問http:// localhost:8080 /上的應用程序

要查看工作版本,請訪問-https://github.com/mikechernev/dockerised-php,並獲得有關為何更改這些內容的更好解釋,請閱讀后續文章-http://geekyplatypus.com/making -您- dockerised的PHP應用程序偶數更好/

我真的希望這會對其他可能遇到類似問題的人有所幫助。

暫無
暫無

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

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