https 403

来源:1-1 课程介绍

szuxxy

2020-03-27

老师,我这边在申请一个https遇到了点问题,不知道怎么解决,请教一下。当然是关于nginx相关的。参考的是这篇文章:https://fanzheng.org/archives/21
但是遇到了一个403的问题。图片描述

这其中/etc/nginx.nginx.conf的配置如下:

user  nginx;

#user  root;
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;
}

其中/etc/nginx/conf.d/order.conf的配置如下:

server{
   listen 80 default_server;
 #  listen 443 default_server;
   server_name  zmfei4.com;

 #   ssl on;
 #   ssl_certificate /var/www/ssl/chained.pem;
 #   ssl_certificate_key /var/www/ssl/domain.key;
  
    listen 443 ssl;  
    ssl_certificate /root/ssl/chained.pem;
    ssl_certificate_key /root/ssl/domain.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;
    ssl_session_cache shared:SSL:50m;

   location /.well-known/acme-challenge/{
      alias /var/challenges/;
      #try_files $uri =404;
  }

   location /static{
   alias /root/du_fruitshop/web/static/;     
  }

   location /{
   #try_files $uri @yourapplication;
      root /root/challenges/;
  }

  #location @yourapplication{
   #include uwsgi_params;
   #uwsgi-pass unix:/root/logs/order.sock;  
 #}

}

回复老师:
我这里看了下日志:
图片描述
我就改了权限且然后发现我这边没有default.conf,于是我在order.conf里加了:
图片描述

然后就发现错误不一样了,变304了:
图片描述

写回答

1回答

Jeson

2020-03-28

先把https的配置注视掉,看看还有访问403的情况吗?

如果还有,看看访问的文件权限是否正确?

0
2
szuxxy
缓存问题了,我用其他浏览器打开就可以了。
2020-03-28
共2条回复

Nginx入门到实践-Nginx中间件应用+搭建Webserver架构

中间件、负载均衡、应用层安全防护、动静分离、Nginx+LUA开发等

4183 学习 · 908 问题

查看课程