Docker 为什么我能';t在本地启动带有图像nginxphp的容器
我尝试从imageDocker 为什么我能';t在本地启动带有图像nginxphp的容器,docker,dockerfile,jelastic,Docker,Dockerfile,Jelastic,我尝试从imagejelastic/nginxphp:1.18.0-php-7.4.10创建一个图像,以设置我现有的Laravel项目(然后放在jelastic云上)。然而,当我试图访问本地主机时,我得到一个ERR\u EMPTY\u响应错误。 我还尝试从jelastic/nginxphp:1.18.0-php-7.4.10图像创建一个容器,但我有相同的错误 我的Dockerfile # ---------- Base ---------- FROM jelastic/nginxphp:1.18
jelastic/nginxphp:1.18.0-php-7.4.10创建一个图像,以设置我现有的Laravel项目(然后放在jelastic云上)。然而,当我试图访问本地主机时,我得到一个ERR\u EMPTY\u响应
错误。
我还尝试从jelastic/nginxphp:1.18.0-php-7.4.10
图像创建一个容器,但我有相同的错误
我的Dockerfile
# ---------- Base ----------
FROM jelastic/nginxphp:1.18.0-php-7.4.10 AS base
# Set main params. The value local is equal to dev
ARG user=runner
ARG BUILD_ENV=local
ARG BUILD_DEBUG=true
ENV APP_HOME /var/www/webroot/ROOT
ENV ENV=$BUILD_ARGUMENT_ENV
ENV DEBUG_ENABLED=$BUILD_DEBUG
# it's the same configuration as the basic one but with the following changes
# /var/www/webroot/ROOT -> /var/www/webroot/ROOT/public
COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf
# Enable PHP extension
RUN yum install -y sed
RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini
# ---------- Builder ----------
FROM base as build
# Set working directory
WORKDIR $APP_HOME
COPY . .
RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; \
else COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress; \
fi
# Create system user
RUN useradd -ms /bin/bash $user
USER $user
# ---------- Base ----------
FROM jelastic/nginxphp:1.18.0-php-7.4.10 AS base
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf
## Set main params. The value local is equal to dev
ARG user=nginx
ARG BUILD_ENV=local
ARG BUILD_DEBUG=true
ENV APP_HOME /var/www/webroot
ENV ENV=$BUILD_ARGUMENT_ENV
ENV DEBUG_ENABLED=$BUILD_DEBUG
## Enable PHP extension
RUN yum install -y sed
RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini
## ---------- Builder ----------
FROM base as build-backend
#
## Set working directory
WORKDIR $APP_HOME
RUN rm -rf index.php
ADD ./ .
RUN chmod -R 777 storage
RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; \
else COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress; \
fi
CMD service php-fpm start && nginx -g "daemon off;"
产生的错误
当我启动此命令时,docker build-t myimage/backend.
,我得到以下结果:
[+] Building 278.0s (13/13) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/jelastic/nginxphp:1.18.0-php-7.4.10 0.0s
=> [base 1/4] FROM docker.io/jelastic/nginxphp:1.18.0-php-7.4.10 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 26.72kB 0.1s
=> CACHED [base 2/4] COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf 0.0s
=> [base 3/4] RUN yum install -y sed 27.8s
=> [base 4/4] RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini 0.5s
=> [build-app 1/4] WORKDIR /var/www/webroot/ROOT 0.0s
=> [build-app 2/4] COPY . . 0.1s
=> [build-app 3/4] RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; else COMPOSER_MEMORY_LIMIT=-1 composer upd 245.9s
=> [build-app 4/4] RUN useradd -ms /bin/bash runner 0.5s
=> exporting to image 3.0s
=> => exporting layers 2.9s
=> => writing image sha256:98c32ac25564198547a767153df9c410467aabdf64c9115158c301272f2de3cc 0.0s
=> => naming to docker.io/myimage/backend
以下是用于创建容器的命令:
C:\Users\Myusername\Documents\projet>docker run -dp 8000:80 myimage/backend
c5c00082d17677bfb599decab892e18de468ab13380ed1d23a38cbf3c06511ee
当我启动这个命令时:docker run-dp 8000:80/nginxphp:1.18.0-php-7.4.10
,我有同样的错误
这是我的nginx服务器配置文件
#user nobody;
worker_processes auto;
worker_rlimit_nofile 2048;
#load_module modules/ngx_http_modsecurity_module.so;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 2048;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
client_max_body_size 100m;
log_format main '$remote_addr:$http_x_remote_port - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_types text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript;
# Websocket support
#upstream websocket {
# server 127.0.0.1:<PORT>;
#}
server {
listen 80;
listen [::]:80;
server_name _;
#charset koi8-r;
access_log /var/log/nginx/host.access.log;
include /etc/nginx/aliases.conf;
#location /ws {
# proxy_pass http://websocket;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
#}
if ($http_x_remote_port = '' ) {
set $http_x_remote_port $remote_port;
}
#modsecurity on;
#modsecurity_rules_file /etc/nginx/conf.d/modsecurity/modsec_includes.conf;
location / {
root /var/www/webroot/ROOT/public;
index index.html index.htm index.php;
location ~ \.php$ {
location ~ /\. { deny all; access_log off; log_not_found off; }
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.socket;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
index index.php index.html index.htm;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
location ~ \.php$ {
proxy_pass http://127.0.0.1;
}
location ~ ^/\.well-known { root /var/www/webroot/ROOT; allow all;}
location ~ /\.well-known { root /var/www/webroot; allow all;}
location ~ /\. { deny all; access_log off; log_not_found off; }
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location ~ \.php$ {
location ~ /\. { deny all; access_log off; log_not_found off; }
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.socket;
fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/webroot;
}
}
include /etc/nginx/conf.d/*.conf;
}
#用户无人;
工人自动处理;
工人信息文件2048;
#加载模块/ngx_http_modsecurity_module.so;
error\u log/var/log/nginx/error.log;
#错误日志/error.log通知;
#错误日志/error.log信息;
#pid日志/nginx.pid;
事件{
工人联合会2048;
}
http{
服务器_令牌关闭;
包括mime.types;
默认_类型应用程序/八位字节流;
客户最大身体尺寸为100m;
日志格式主“$remote\u addr:$http\u x\u remote\u port-$remote\u user[$time\u local]“$request””
“$status$body\u bytes\u sent”$http\u referer”
“$http_user_agent”$http_x_forwarded_for”
“$host”sn=“$server\u name””
'rt=$request\u time'
'ua=“$上游地址”us=“$上游地址”状态”
'ut=“$upstream\u response\u time”ul=“$upstream\u response\u length”'
'cs=$upstream_cache_status';
access\u log/var/log/nginx/access.log main;
发送文件到;
#tcp_nopush on;
#保持激活超时0;
保持生命超时65;
gzip on;
gzip_类型text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript;
#腹板支架
#上游网箱{
#服务器127.0.0.1:;
#}
服务器{
听80;
听[:]:80;
服务器名称;
#charset-koi8-r;
access_log/var/log/nginx/host.access.log;
包括/etc/nginx/aliases.conf;
#位置/ws{
#代理通行证http://websocket;
#proxy_http_版本1.1;
#代理设置头升级$http\U升级;
#代理设置头连接“升级”;
#}
如果($http_x_remote_port=''){
设置$http_x_remote_port$remote_port;
}
#modon安全;
#modsecurity_rules_file/etc/nginx/conf.d/modsecurity/modsec_includes.conf;
地点/{
root/var/www/webroot/root/public;
index.html index.htm index.php;
位置~\.php${
位置~/\.{deny all;access\u log off;log\u not\u found off;}
包括/etc/nginx/fastcgi_参数;
fastcgi_pass unix:/var/run/php-fpm.socket;
fastcgi_参数脚本_文件名$realpath_根$fastcgi_脚本_名称;
fastcgi_参数文档_ROOT$realpath_ROOT;
fastcgi_参数路径_信息$fastcgi_脚本_名称;
}
}
index.php index.html index.htm;
#错误\u第404/404.html页;
#将服务器错误页面重定向到静态页面/50x.html
#
错误\u第500页502 503 504/50x.html;
location=/50x.html{
根html;
}
#将PHP脚本代理到Apache,并在127.0.0.1:80上侦听
#
位置~\.php${
代理通行证http://127.0.0.1;
}
位置~^/\.众所周知的{root/var/www/webroot/root;allow all;}
位置~/\.众所周知的{root/var/www/webroot;allow all;}
位置~/\.{deny all;access\u log off;log\u not\u found off;}
#将PHP脚本传递给FastCGI服务器,并在127.0.0.1:9000上侦听
#
#位置~\.php${
#根html;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index.php;
#fastcgi_参数SCRIPT_FILENAME/scripts$fastcgi_SCRIPT_name;
#包括fastcgi_参数;
#}
#拒绝访问.htaccess文件,如果Apache的文档根
#同意nginx的观点
#
#位置~/\.ht{
#否认一切;
#}
位置~\.php${
位置~/\.{deny all;access\u log off;log\u not\u found off;}
包括/etc/nginx/fastcgi_参数;
fastcgi_pass unix:/var/run/php-fpm.socket;
fastcgi_参数SCRIPT_FILENAME/var/www/webroot$fastcgi_SCRIPT_name;
fastcgi_参数路径_信息$fastcgi_脚本_名称;
fastcgi_参数文件_ROOT/var/www/webroot;
}
}
包括/etc/nginx/conf.d/*.conf;
}
经过广泛的研究和测试。我设法使一个laravel
图像从jelastic/nginxphp:1.18.0-php-7.4.10
对于那些感兴趣的人,我给你们留下我的解决方案。如果你有更好的解决方案或改进,不要害怕展示你的解决方案
Dockerfile
# ---------- Base ----------
FROM jelastic/nginxphp:1.18.0-php-7.4.10 AS base
# Set main params. The value local is equal to dev
ARG user=runner
ARG BUILD_ENV=local
ARG BUILD_DEBUG=true
ENV APP_HOME /var/www/webroot/ROOT
ENV ENV=$BUILD_ARGUMENT_ENV
ENV DEBUG_ENABLED=$BUILD_DEBUG
# it's the same configuration as the basic one but with the following changes
# /var/www/webroot/ROOT -> /var/www/webroot/ROOT/public
COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf
# Enable PHP extension
RUN yum install -y sed
RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini
# ---------- Builder ----------
FROM base as build
# Set working directory
WORKDIR $APP_HOME
COPY . .
RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; \
else COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress; \
fi
# Create system user
RUN useradd -ms /bin/bash $user
USER $user
# ---------- Base ----------
FROM jelastic/nginxphp:1.18.0-php-7.4.10 AS base
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf
## Set main params. The value local is equal to dev
ARG user=nginx
ARG BUILD_ENV=local
ARG BUILD_DEBUG=true
ENV APP_HOME /var/www/webroot
ENV ENV=$BUILD_ARGUMENT_ENV
ENV DEBUG_ENABLED=$BUILD_DEBUG
## Enable PHP extension
RUN yum install -y sed
RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini
## ---------- Builder ----------
FROM base as build-backend
#
## Set working directory
WORKDIR $APP_HOME
RUN rm -rf index.php
ADD ./ .
RUN chmod -R 777 storage
RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; \
else COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress; \
fi
CMD service php-fpm start && nginx -g "daemon off;"
nginx.conf
#user nobody;
worker_processes auto;
worker_rlimit_nofile 2048;
#load_module modules/ngx_http_modsecurity_module.so;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 2048;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
client_max_body_size 100m;
log_format main '$remote_addr:$http_x_remote_port - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_types text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript;
server {
listen 80 ;
listen [::]:80;
server_name _;
charset utf-8;
access_log /var/log/nginx/host.access.log;
error_log /var/log/nginx/host.error.log;
include /etc/nginx/aliases.conf;
index index.php;
root /var/www/webroot/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
#modsecurity on;
#modsecurity_rules_file /etc/nginx/conf.d/modsecurity/modsec_includes.conf;
if ($http_x_remote_port = '' ) {
set $http_x_remote_port $remote_port;
}
# enforce NO www
if ($host ~* ^www\.(.*)) {
set $host_without_www $1;
rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
error_page 404 /index.php;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
#location /ws {
# proxy_pass http://websocket;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
#}
# serve static files directly
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
#location ~ /\. { deny all; access_log off; log_not_found off; }
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.socket;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
include /etc/nginx/conf.d/*.conf;
}
经过广泛的研究和测试。我设法使一个laravel
图像从jelastic/nginxphp:1.18.0-php-7.4.10
对于那些感兴趣的人,我给你们留下我的解决方案。如果你有更好的解决方案或改进,不要害怕展示你的解决方案
Dockerfile
# ---------- Base ----------
FROM jelastic/nginxphp:1.18.0-php-7.4.10 AS base
# Set main params. The value local is equal to dev
ARG user=runner
ARG BUILD_ENV=local
ARG BUILD_DEBUG=true
ENV APP_HOME /var/www/webroot/ROOT
ENV ENV=$BUILD_ARGUMENT_ENV
ENV DEBUG_ENABLED=$BUILD_DEBUG
# it's the same configuration as the basic one but with the following changes
# /var/www/webroot/ROOT -> /var/www/webroot/ROOT/public
COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf
# Enable PHP extension
RUN yum install -y sed
RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini
# ---------- Builder ----------
FROM base as build
# Set working directory
WORKDIR $APP_HOME
COPY . .
RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; \
else COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress; \
fi
# Create system user
RUN useradd -ms /bin/bash $user
USER $user
# ---------- Base ----------
FROM jelastic/nginxphp:1.18.0-php-7.4.10 AS base
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
COPY docker-conf/nginx/conf.d/nginx.conf /etc/nginx/nginx.conf
## Set main params. The value local is equal to dev
ARG user=nginx
ARG BUILD_ENV=local
ARG BUILD_DEBUG=true
ENV APP_HOME /var/www/webroot
ENV ENV=$BUILD_ARGUMENT_ENV
ENV DEBUG_ENABLED=$BUILD_DEBUG
## Enable PHP extension
RUN yum install -y sed
RUN sed -i "s|;extension=pdo_mysql.so|extension=pdo_mysql.so|g" /etc/php.ini
## ---------- Builder ----------
FROM base as build-backend
#
## Set working directory
WORKDIR $APP_HOME
RUN rm -rf index.php
ADD ./ .
RUN chmod -R 777 storage
RUN if [ "$BUILD_ARGUMENT_ENV" = "production" ];then COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress --no-dev; \
else COMPOSER_MEMORY_LIMIT=-1 composer update --optimize-autoloader --no-interaction --no-progress; \
fi
CMD service php-fpm start && nginx -g "daemon off;"
nginx.conf
#user nobody;
worker_processes auto;
worker_rlimit_nofile 2048;
#load_module modules/ngx_http_modsecurity_module.so;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 2048;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
client_max_body_size 100m;
log_format main '$remote_addr:$http_x_remote_port - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_types text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript;
server {
listen 80 ;
listen [::]:80;
server_name _;
charset utf-8;
access_log /var/log/nginx/host.access.log;
error_log /var/log/nginx/host.error.log;
include /etc/nginx/aliases.conf;
index index.php;
root /var/www/webroot/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
#modsecurity on;
#modsecurity_rules_file /etc/nginx/conf.d/modsecurity/modsec_includes.conf;
if ($http_x_remote_port = '' ) {
set $http_x_remote_port $remote_port;
}
# enforce NO www
if ($host ~* ^www\.(.*)) {
set $host_without_www $1;
rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
error_page 404 /index.php;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
#location /ws {
# proxy_pass http://websocket;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
#}
# serve static files directly
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
#location ~ /\. { deny all; access_log off; log_not_found off; }
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.socket;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
include /etc/nginx/conf.d/*.conf;
}
容器的日志说明了什么?dockerfile生成的结果是什么?如何从生成的图像启动容器?您试图在本地主机地址上访问您的站点:您是否从t映射了80/443端口