通过Docker容器中的Nginx部署应用程序时出现403禁止错误

时间:2018-12-05 02:25:43

标签: docker nginx

我正在尝试通过nginx在Docker容器中部署前端。网址应为http://10.122.45.116/sub

我继续收到403禁止错误。该文件已存在。 / home目录和index_.html文件的权限均为777。我认为默认情况下应打开端口80。

这是/etc/nginx/conf.d/nginx.conf的内容:

Country        -->    Country_Japan    Country_USA    Country_Canada
-------               -------------    -----------    ---------------
Japan                        1              0                0
USA                          0              1                0
Japan                        1              0                0
....

这是/etc/nginx/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;
    }
 }

这是supervisord.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;
}

我看过各种答案,但似乎没有一个对我有帮助。 请帮忙!

1 个答案:

答案 0 :(得分:-2)

10.122.45.11 此ip是专用IP

您的公共IP地址是什么,然后尝试使用公共ip

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