导读


搭建的Nginx图片服务器和ftp服务器出现403的问题。

问题分析


权限不足,资源访问不了。

解决办法


添加root权限,并且将访问目录设置成可读写
修改nginx.conf文件,在最上方添加user root;

  1. # 添加权限
  2. user root;
  3. worker_processes 1;
  4. error_log /var/log/nginx/error.log warn;
  5. pid /var/run/nginx.pid;
  6. events {
  7. worker_connections 1024;
  8. }
  9. http {
  10. include /etc/nginx/mime.types;
  11. default_type application/octet-stream;
  12. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  13. '$status $body_bytes_sent "$http_referer" '
  14. '"$http_user_agent" "$http_x_forwarded_for"';
  15. access_log /var/log/nginx/access.log main;
  16. sendfile on;
  17. #tcp_nopush on;
  18. keepalive_timeout 65;
  19. #gzip on;
  20. include /etc/nginx/conf.d/*.conf;
  21. }
  22. ~

image.pngimage.png