GVKun编程网logo

docker-compose中nginx可以访问html无法访问php 提示File not found. ?(nginx访问不到html)

21

在本文中,我们将为您详细介绍docker-compose中nginx可以访问html无法访问php提示Filenotfound.?的相关知识,并且为您解答关于nginx访问不到html的疑问,此外,我

在本文中,我们将为您详细介绍docker-compose中nginx可以访问html无法访问php 提示File not found. ?的相关知识,并且为您解答关于nginx访问不到html的疑问,此外,我们还会提供一些关于62-docker-compose 结合 dockerfile 部署 springboot 应用、62-docker-compose 结合dockerfile 部署springboot应用、Centos 7 安装 nginx安装,提示:c compiler cc is not found、centos7安装nginx 报./configure: error: C compiler cc is not found的有用信息。

本文目录一览:

docker-compose中nginx可以访问html无法访问php 提示File not found. ?(nginx访问不到html)

docker-compose中nginx可以访问html无法访问php 提示File not found. ?(nginx访问不到html)

这几天在搞docker-compose中Nginx+PHP环境,搭建好之后出现可以访问.html文件,但是访问不了.PHP文件

 

 

第一种:没有解析PHP文件

1:更改配置文件Nginx.conf 
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
替换成下面(就是把你root文件夹设为其他用户允许)

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

2:注意fastcgi_pass

 

 因为docker-compose.yml中的PHP的services叫PHP-fpm,所以这里就是PHP-fpm:9000

第一种:数据卷挂载问题

记得把PHP和Nginx挂载在同一个数据卷下面

 

62-docker-compose 结合 dockerfile 部署 springboot 应用

62-docker-compose 结合 dockerfile 部署 springboot 应用

dockerfile 内容:

# 基础镜像
FROM  openjdk:8-jre
# author
MAINTAINER lw

# 挂载目录
VOLUME /home/ybss
# 创建目录
RUN mkdir -p /home/ybss
# 指定路径
WORKDIR /home/ybss

ADD ./jar/lib /home/ybss/lib
ADD ./jar/*.yml /home/ybss/
# 复制jar文件到路径
COPY ./jar/run.jar /home/ybss/run.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","-Dserver.port=9200","-Dspring.profiles.active=dev","run.jar"]

docker-compose.yml 内容:

version : ''3.8''
services:
  ybss-auth:
    container_name: ybss-auth
    build:
      context: ./ybss/auth
      dockerfile: dockerfile
    ports:
      - "19200:9200"
    volumes:
      - /home/ybss/ybss/auth/jar:/home/ybss

networks:
  ybss_default:
    driver: bridge

volumes 挂载目录 /home/ybss/ybss/auth/jar,有更新时,只需要把更新 jar 和文件替换即可。

部署脚本 shell:

#!/bin/sh
auth(){
  chmod 777 -R ./ybss/auth/*
  docker-compose up -d ybss-auth
}
stop(){
	docker-compose stop
}
case "$1" in
"auth")
	auth
;;
"s")
	stop
;;

62-docker-compose 结合dockerfile 部署springboot应用

62-docker-compose 结合dockerfile 部署springboot应用

dockerfile内容:

# 基础镜像
FROM  openjdk:8-jre
# author
MAINTAINER lw

# 挂载目录
VOLUME /home/ybss
# 创建目录
RUN mkdir -p /home/ybss
# 指定路径
WORKDIR /home/ybss

ADD ./jar/lib /home/ybss/lib
ADD ./jar/*.yml /home/ybss/
# 复制jar文件到路径
COPY ./jar/run.jar /home/ybss/run.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","-Dserver.port=9200","-Dspring.profiles.active=dev","run.jar"]

docker-compose.yml 内容:

version : ''3.8''
services:
  ybss-auth:
    container_name: ybss-auth
    build:
      context: ./ybss/auth
      dockerfile: dockerfile
    ports:
      - "19200:9200"
    volumes:
      - /home/ybss/ybss/auth/jar:/home/ybss

networks:
  ybss_default:
    driver: bridge

volumes挂载目录/home/ybss/ybss/auth/jar,有更新时,只需要把更新jar和文件替换即可。

部署脚本shell:

#!/bin/sh
auth(){
  chmod 777 -R ./ybss/auth/*
  docker-compose up -d ybss-auth
}
stop(){
    docker-compose stop
}
case "$1" in
"auth")
    auth
;;
"s")
    stop
;;

Centos 7 安装 nginx安装,提示:c compiler cc is not found

Centos 7 安装 nginx安装,提示:c compiler cc is not found

在VMware 中安装Centos7后,准备安装Nginx-1.10.3

将Nginx-1.10.3.tar.gz,解压之后,进入Nginx-1.10.3目录,准备安装,执行make && make install,

系统提示如下信息:

checking for OS
 + Linux 4.4.0-127-generic x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found

查了下网上的资料,解决方案也不复杂。

原因是因为缺少 gcc-c++ 的包

解决办法很简单,执行:yum -y install gcc-c++

在执行上诉命令过程中,可能因为网络问题导致下载相关依赖包失败,可以尝试多试几次,我最后是通过链接手机wifi才下载安装成功的。

安装成功之后,执行命令:cd Nginx-1.10.3 && ./configure --prefix=/usr/local/Nginx 检查一下

出现这个说明,Nginx安装环境没问题,准备开始安装Nginx,执行make && make install

安装完成之后,启动Nginx,命令:/usr/local/Nginx/sbing/Nginx 

输入:curl http://localhost 

Nginx 安装成功!

centos7安装nginx 报./configure: error: C compiler cc is not found

centos7安装nginx 报./configure: error: C compiler cc is not found

 

 

CentOS 7 下 安装 nginx 执行配置命令

./configure 

时提示以下错误:

              

解决:

执行以下命令:

  1. yum -y install gcc gcc-c++ autoconf automake make  
  2. 上述安装成功后在尝试安装
  3. 显示安装成功
  1.  

 

今天关于docker-compose中nginx可以访问html无法访问php 提示File not found. ?nginx访问不到html的介绍到此结束,谢谢您的阅读,有关62-docker-compose 结合 dockerfile 部署 springboot 应用、62-docker-compose 结合dockerfile 部署springboot应用、Centos 7 安装 nginx安装,提示:c compiler cc is not found、centos7安装nginx 报./configure: error: C compiler cc is not found等更多相关知识的信息可以在本站进行查询。

本文标签: