Today messed around, configured a file virtual directory, the result access file has been reported 403 error, with a variety of methods, finally solved, make a note.

  • 1. Document Authorization:
chmod 777 /home/image/
Copy the code
  • 2.Nginx authorization (nginx.conf) :
user  root;
Copy the code
  • Nginx domain name configuration:
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;
    }
Copy the code