简体   繁体   中英

403 Forbidden Error when deploying app through nginx in docker container

I'm trying to deploy my frontend through nginx in a docker container. The URL should be http://10.122.45.116/sub .

I keep on getting 403 Forbidden Error. The file is existing. The permissions of both /home directory and index_.html file is 777. I suppose port 80 should be open by default.

Here is the content of /etc/nginx/conf.d/nginx.conf:

server {
    listen 80;
    server_name 10.122.45.116;
    location /sub {
        root /home;
        index index_.html;
        include uwsgi_params;
        uwsgi_pass 0.0.0.0:5000;
    }
 }

Here is the content of /etc/nginx/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"';
  access_log  /var/log/nginx/access.log  main;
  sendfile        on;
  #tcp_nopush     on;
  keepalive_timeout  65;
  #gzip  on;
  include /etc/nginx/conf.d/*.conf;
}

Here is the code of supervisord.conf:

[supervisord]
nodaemon=true

[program:nginx]
command=/usr/sbin/nginx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
# Graceful stop, see http://nginx.org/en/docs/control.html
stopsignal=QUIT

I've looked at various answers but none of them seemed to help me. Please help!

10.122.45.11 this ip is Private IP

what is your public ip address and try with public ip

What is the difference between a Public IP address and a Private IP address?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM