Nginx 403 访问受限问题

794 阅读1分钟

今天瞎搞,配置了一个文件虚拟目录,结果访问文件一直报403错误,用了好多种方法,终于解决,做个笔记。

  • 1.文件授权:
chmod 777 /home/image/
  • 2.Nginx授权(nginx.conf):
user  root;
  • 3.Nginx域名配置:
server
    {
	listen 443 ssl;
	
	ssl_certificate /home/xxxx.crt;
        ssl_certificate_key /home/xxxx.key;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
		
        #listen [::]:80 default_server ipv6only=on;
        server_name res.apiopen.top;
        index index.html index.htm index.php;
        root  /home/image/;

        #error_page  404 https://www.xxxxx.top/404;
        include enable-php.conf;
		
		
		location / {  
		index  index.html index.htm  index.php;
		autoindex  on;  
		}  
		
 
		access_log  /www/wwwlogs/blogaccess.log;
    }