dockerized vujs nginx 403错误:“/etc/nginx/html/&quort”目录索引被禁止
我正在尝试使用Nginx对Vuejs应用进行扩展,但它一直向我展示此错误。
[error] 8#8: *1 directory index of "/etc/nginx/html/" is forbidden, client: x.x.x.x, server: localhost, request: "GET / HTTP/1.1", host: "x.x.x.x:80"
[error] 8#8: *1 directory index of "/etc/nginx/html/" is forbidden, client: x.x.x.x, server: localhost, request: "GET / HTTP/1.1", host: "x.x.x.x:80"
[error] 8#8: *1 directory index of "/etc/nginx/html/" is forbidden, client: x.x.x.x, server: localhost, request: "GET / HTTP/1.1", host: "x.x.x.x:80"
这是我的docker和nginx配置:
dockerfile
FROM nginx:1.17-alpine
# Copy built app into nginx
COPY /dist /etc/nginx/html/studio
# copy nginx conf
COPY nginx.conf /etc/nginx/nginx.conf
nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
map $http_user_agent $loggable {
"~kube-probe/.*" 0;
default 1;
}
access_log /var/log/nginx/access.log main if=$loggable;
server {
listen 80;
server_name localhost;
location /studio/ {
try_files $uri $uri/ /studio/index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
当我访问浏览器时显示:503服务暂时不可用-Nginx
I am trying to dockerize a VueJS app using nginx , but it keeps showing me this error .
[error] 8#8: *1 directory index of "/etc/nginx/html/" is forbidden, client: x.x.x.x, server: localhost, request: "GET / HTTP/1.1", host: "x.x.x.x:80"
[error] 8#8: *1 directory index of "/etc/nginx/html/" is forbidden, client: x.x.x.x, server: localhost, request: "GET / HTTP/1.1", host: "x.x.x.x:80"
[error] 8#8: *1 directory index of "/etc/nginx/html/" is forbidden, client: x.x.x.x, server: localhost, request: "GET / HTTP/1.1", host: "x.x.x.x:80"
This my docker and nginx configuration :
Dockerfile
FROM nginx:1.17-alpine
# Copy built app into nginx
COPY /dist /etc/nginx/html/studio
# copy nginx conf
COPY nginx.conf /etc/nginx/nginx.conf
nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
map $http_user_agent $loggable {
"~kube-probe/.*" 0;
default 1;
}
access_log /var/log/nginx/access.log main if=$loggable;
server {
listen 80;
server_name localhost;
location /studio/ {
try_files $uri $uri/ /studio/index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
When I access the browser it shows : 503 Service Temporarily Unavailable - nginx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论