[英]Nginx index.html instead of my own index.html
I had been trying the tutorial for docker following this link: http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/ 我一直在尝试通过以下链接获取有关docker的教程: http : //geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/
However I get stuck on where to display my own index.html in my /code path. 但是,我陷入了在/ code路径中显示自己的index.html的问题。 Instead ,it displays the page of Welcome to nginx!.
而是显示“欢迎使用nginx!”页面。 All of my files are the same as in the link.
我所有的文件都与链接中的相同。 My files contained a code folder(inside is my index.html), docker-compose, site.conf where the same as the link.
我的文件包含一个代码文件夹(里面是我的index.html),docker-compose,site.conf,与链接相同。
I had search and try on many ways and couldn't get it to work. 我进行了搜索,并尝试了许多方法,但无法正常工作。 Appreciate if someone can point me a direction to proceed.
谢谢有人能为我指明前进的方向。
I am using docker toolbox on windows os. 我在Windows OS上使用docker工具箱。
Provided here is the configuration files for site.conf and docker-compose.yml 这里提供的是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
As the person who wrote the blog post I feel both thrilled and a bit ashamed to see this question 😅 作为写博客文章的人,看到这个问题既让我感到兴奋又感到羞愧😅
To answer your specific question - you need to do two things: 要回答您的特定问题-您需要做两件事:
php-docker.local
. php-docker.local
。 I see that it is no longer in your nginx config, so I guess you should be good ./site.conf:/etc/nginx/conf.d/site.conf
part in the docker-compose.yml
to ./site.conf:/etc/nginx/conf.d/default.conf
./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
These two steps simplify the flow and allow you to access the application on http://localhost:8080/ 这两个步骤简化了流程,并允许您访问http:// localhost:8080 /上的应用程序
To see the working version you can go to - https://github.com/mikechernev/dockerised-php and for a better explanation on why these are changed you can read the follow up post - http://geekyplatypus.com/making-your-dockerised-php-application-even-better/ 要查看工作版本,请访问-https://github.com/mikechernev/dockerised-php,并获得有关为何更改这些内容的更好解释,请阅读后续文章-http://geekyplatypus.com/making -您- dockerised的PHP应用程序偶数更好/
I really hope this will help others that might stumble into similar issues. 我真的希望这会对其他可能遇到类似问题的人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.